Possible Duplicate:
How do the In and Out attributes work in .NET?
I'm using .Net Remoting (yeah I know... that's old) to implement some service class hosted in a Windows Service.
I call a method DoOperation(Person[] people)
on the service to change some property in the Person
class just like the code below:
Person p = new Person();
p.SomeProperty = "This value should be changed by the service";
RemoveSvc svc = (RemoveSvc)Activator.GetObject(
typeof(RemoveSvc),
"tcp://localhost:6100/RemoteService.rem");
svc.DoOperation(new Person[]{ p });
// This writes the old value not the one changed by the service.
Console.WriteLine(p.SomeProperty);
The DoOperation
method code looks like this:
public void DoOperation(Person[] people) {
foreach(var o in people)
p.SomeProperty = "New Value";
}
The problem here is that when the method returns the value of Person.SomeProperty
is not updated in the client code.
I have double checked that Person
class is serializable;
The svc
variable is of type TranparentProxy
;
The RemoteSvc
class inherits MarshalByRefObject
;
I´m using .net Framework 4 (and no, I can´t migrate to WCF)
What am I doing wrong? Is this the expected behavior of .net Remoting? If it is, there is a way to change it?
Tks