Summary of Web Method in Web Services (2)

xiaoxiao2021-03-05  30

Because it is the first time I use WebService, it is not too good to understand many places.

At first, I want to pass or return to the custom type, need to use

[System.xml.serialization.xmlinclude (typeof (...)]]

The description of MSDN is: Allow XMLSerializer to identify the type when it serially or reverse sequences.

Use XMLINCLUDEATTRIBUTE when tapping the XMLSERIALIZER class's Serialize or DeSerialize method.

When using XMLinCludeAttribute, specify the Type of the school. XMLSerializer sequences simultaneously contains the base class and derived objects, it can identify two object types.

However, when using a custom type, apply the SerializableAttribute property to a type to indicate that the instance of this type can be serialized.

Using system;

Namespace clscommon {///

/// Person 概 要 说明 说明 说明. /// [serializable] public class person {public string name; public string gender;

Public persons () {}

Public Person (String name, string gender) {name = name; gender = gender;}}}

Use XMLINCLUDEATTRIBUTE when tapping the XMLSERIALIZER class's Serialize or DeSerialize method.

When using XMLinCludeAttribute, specify the Type of the school. XMLSerializer sequences simultaneously contains the base class and derived objects, it can identify two object types.

However, when using a custom type, apply the SerializableAttribute property to a type to indicate that the instance of this type can be serialized.

Using system;

Namespace clscommon {///

/// Person 概 要 说明 说明 说明. /// [serializable] public class person {public string name; public string gender;

Public persons () {}

Public Person (String name, string gender) {name = name; gender = gender;}}}

Use XMLINCLUDEATTRIBUTE when tapping the XMLSERIALIZER class's Serialize or DeSerialize method.

When using XMLinCludeAttribute, specify the Type of the school. XMLSerializer sequences simultaneously contains the base class and derived objects, it can identify two object types.

However, when using a custom type, apply the SerializableAttribute property to a type to indicate that the instance of this type can be serialized.

Using system;

Namespace clscommon {///

/// Person 概 要 说明 说明 说明. /// [serializable] public class person {public string name; public string gender;

Public persons () {}

Public Person (String Name, String GenDer) {name = name; gender = gender;}} XMLinCludeAttribute when the XMLSerizer class is called.

When using XMLinCludeAttribute, specify the Type of the school. XMLSerializer sequences simultaneously contains the base class and derived objects, it can identify two object types.

However, when using a custom type, apply the SerializableAttribute property to a type to indicate that the instance of this type can be serialized.

Using system;

Namespace clscommon {///

/// Person 概 要 说明 说明 说明. /// [serializable] public class person {public string name; public string gender;

Public persons () {}

Public Person (String name, string gender) {name = name; gender = gender;}}}

转载请注明原文地址:https://www.9cbs.com/read-33767.html

New Post(0)