2012-09-28 77 views
1

我需要将powerbuilder 11.5中的部分代码模仿到C#3.0。在powerbuilder中,代码具有oleobject并使用connecttonewobject连接到对象。有人能告诉我什么是C#中的等价物以及在这里使用什么。谢谢!oleobject替代c#

回答

2

下面是使用C#动态属性(就像PB对象)

// get the class id from name 
Type myComType = Type.GetTypeFromProgID("SAP.BAPI"); 

// equal to connect to ojbect in PB 
dynamic myComInstance = Activator.CreateInstance(myComType, false); 

// calling function equivalent to oleobject.function in PB 
myComInstance.ShowDialog("Hello World"); 
一个基本的例子