ToString () in class Webservice

I have applied an override method ToString()

for my class in my web service, and I return List<myObject>()

to a function on the consumer. If I do .ToString()

, it returns the type of the object. How do I do this in C #?

Thanks.

+1


a source to share


1 answer


When passing objects back and forth to the webservice, it simply passes the XML representations of the public properties of that object. Any methods, overridden or not, don't come with it.

I would recommend creating a StringRepresentation property that calls ToString ()



public string StringRepresentation
{
    get { return this.ToString(); }
    set { /* Do Nothing, but there has to be a set */ }
}

      

+3


a source







All Articles