Click to See Complete Forum and Search --> : WCF Serialization


dannystommen
October 8th, 2008, 05:37 AM
Is it also possible to serialize a method using WCF. For type [DataContract] needs to be used and for members [DataMember] should be used.

[DataContract]
public class User {

[DataMember]
public string Name {
get;
set;
}

//I want to to the same thing here
public override string ToString() {
return "Hello";
}
}

Note. This is not the service but a type that is passes by the service.

Is this possible for a method. Or do I need to do this using the service itself?

boudino
October 8th, 2008, 06:46 AM
No, it isn't. And it doesn't make sence to have such an ability, because passing methods would break encapsulation.