Use VB.Net Activator.GetObject with arguements
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.
精彩评论