Returning User-Defined Types

It is often necessary to return user-defined types from a method, such as employee or department. When doing so, the WebService serialization will create a generic representation of the data element to return to the client. It is important to understand that WebServices should be used to return data and not objects. Essentially, a memento should be returned rather than trying to instantiate an object and attempt distributed reference counts.

A memento represents the current state of an object or the data necessary to describe an object. In the case of an employee, the basic information such as ID, name, department, and photo ID would represent the data associated with the employee.

The serialization services will ...

Get C# and the .NET Framework: The C++ Perspective now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.