static void Main(string[] args) { using (var communicator = Util.initialize(ref args)) //创建Communicator对象 { ObjectPrx basePrx = communicator.stringToProxy("AStockService:default -p 10000"); //创建客户端基类代理 AStockServicePrx aStockServicePrx = AStockServicePrxHelper.checkedCast(basePrx); //把基类代理转换为子类代理 var companyInfo = aStockServicePrx.GetCompanyInfo(1000); //调用GetCompanyInfo方法 Console.WriteLine($"id:{companyInfo.id} name:{companyInfo.name} addr:{companyInfo.addr}"); //输出返回结果 } Console.Read(); }
public static AStockServicePrx uncheckedCast(global::Ice.ObjectPrx b) { if (b == null) { return(null); } AStockServicePrx r = b as AStockServicePrx; if (r == null) { AStockServicePrxHelper h = new AStockServicePrxHelper(); h.iceCopyFrom(b); r = h; } return(r); }
public static AStockServicePrx checkedCast(global::Ice.ObjectPrx b, global::System.Collections.Generic.Dictionary <string, string> ctx) { if (b == null) { return(null); } AStockServicePrx r = b as AStockServicePrx; if ((r == null) && b.ice_isA(ice_staticId(), ctx)) { AStockServicePrxHelper h = new AStockServicePrxHelper(); h.iceCopyFrom(b); r = h; } return(r); }
public static void write(global::Ice.OutputStream ostr, AStockServicePrx v) { ostr.writeProxy(v); }