2012-09-28 123 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"); 
一個基本的例子