G
Guest
Hi!
My client fetches an object from the remote server. The client clones the
object and proceedes with its client processing.
If I don't clone the object each use of the object results in requests to
the server via the BinaryFormatterSink. Sometimes this produces a
RemoteException.
So, therefore I clone the object in the client. But I still get problem with
an enum member in the object, refering the enum member causes trafic to the
server via the BinaryFormatterSink which results in a RemoteException.
That leeds to the question: how to clone an enum member in a class?
Consider this:
Public Class MyClass
Public Enum MyEnum As Integer
A = 1
B = 2
End Enum
Public Id as Integer
Public Name as String
Public State as MyEnum
Public Function Clone() as MyClass
Dim o as New MyClass
o.Id = Id
o.Name = String.Copy(Name)
o.State = State 'this is not a clone! enums are
reference type
return o
End Function
End Class
How to clone the State enum?
A more detailed description of my problem:
--------------------------------------------------
There is a RemoteException thrown from the server when I log the state in
the client:
Debug.WriteLine("Current state = " & myObject.State.ToString())
The state.tostring() causes trafic to the server resulting in a
RemoteException.
If comment the trace line everything works fine!
What happens and what should I do???
My client fetches an object from the remote server. The client clones the
object and proceedes with its client processing.
If I don't clone the object each use of the object results in requests to
the server via the BinaryFormatterSink. Sometimes this produces a
RemoteException.
So, therefore I clone the object in the client. But I still get problem with
an enum member in the object, refering the enum member causes trafic to the
server via the BinaryFormatterSink which results in a RemoteException.
That leeds to the question: how to clone an enum member in a class?
Consider this:
Public Class MyClass
Public Enum MyEnum As Integer
A = 1
B = 2
End Enum
Public Id as Integer
Public Name as String
Public State as MyEnum
Public Function Clone() as MyClass
Dim o as New MyClass
o.Id = Id
o.Name = String.Copy(Name)
o.State = State 'this is not a clone! enums are
reference type
return o
End Function
End Class
How to clone the State enum?
A more detailed description of my problem:
--------------------------------------------------
There is a RemoteException thrown from the server when I log the state in
the client:
Debug.WriteLine("Current state = " & myObject.State.ToString())
The state.tostring() causes trafic to the server resulting in a
RemoteException.
If comment the trace line everything works fine!
What happens and what should I do???