开发者

Use VB.Net Activator.GetObject with arguements

开发者 https://www.devze.com 2023-04-02 06:10 出处:网络
At the moment i\'m creating a remote object instance by: Dim serverURI = String.Format(\"{0}://localhost:{1}/{2}\", IPC.Protoc开发者_运维百科ol, IPC.port, IPC.Channel_name)

At the moment i'm creating a remote object instance by:

Dim serverURI = String.Format("{0}://localhost:{1}/{2}", IPC.Protoc开发者_运维百科ol, IPC.port, IPC.Channel_name)
Me.Server = CType(Activator.GetObject(GetType(RemotebaleServiceCommands), serverURI), RemotebaleServiceCommands)

I need to pass some constructor arguments to RemotebaleServiceCommands call. Can you help me?

Thanks!


Activator.GetObject() does not create an instance, it connects to an object that's already created. Your question suggests that you actually want to use Activator.CreateInstance(). It has lots of overloads, several of which allow you to pass arguments to the constructor.

0

精彩评论

暂无评论...
验证码 换一张
取 消