Activator.GetObject - Using the state parameter
.net, activator, parameters, remoting, state
Solution
I'm not entirely sure what the purpose of this state field is but it appears to be a channel specific value that's not of use to your code. In tracing through `Activator.GetObject` in Reflector you'll notice that it eventually gets passed to `IChannelSender.CreateMessageSink`. The use of this data is implementation specific.
A quick search revealed only one implementor if `IChannelSender`: `CrossAppDomainChannel`. In this particular implementation the state parameter is only used if it is of a particular type: `CrossAppDomainData`. This is an internal class which is not accessible to your program and hence is of no use.
Problem
In .NET Remoting, Activator.GetObject method has a state parameter. What is the purpose of this state param? Can I retrieve its value from server side? mdsn didn't help much. What I'd like to do: Client side: `ChannelServices.RegisterChannel(new TcpChannel(0));` `object obj = Activator.GetObject(typeof(MyObj), "tcp://serverName:1234/RemoteObj", "myCustomData");` Server side: Get access to the "myCustomData" string.