Since it was the first time to use WebService, it is not very easy to understand in many places.
At first, we thought we needed to pass in or return a custom type.
[System. xml. serialization. xmlinclude (typeof (...)]
Msdn Description: allows xmlserializer to identify the type when it serializes or deserializes an object.
Used when you call the serialize or deserialize methods of the xmlserializer classXmlincludeattribute.
When the applicationXmlincludeattributeSpecify the type of the derived class.XmlserializerAfter serialization contains objects of both the base class and the derived class, it can recognize two types of objects.
However, when using a custom typeSerializableattributeAttribute is applied to a type that indicates that instances of this type can be serialized.
Using system;
Namespace clscommon
{
/// <Summary>
/// The person role summary contains the specified role.
/// </Summary>
[Serializable]
Public class person
{
Public string name;
Public String gender;
Public Person ()
{}
Public Person (string name, string gender)
{
Name = Name;
Gender = gender;
}
}
}
Used when you call the serialize or deserialize methods of the xmlserializer classXmlincludeattribute.
When the applicationXmlincludeattributeSpecify the type of the derived class.XmlserializerAfter serialization contains objects of both the base class and the derived class, it can recognize two types of objects.
However, when using a custom typeSerializableattributeAttribute is applied to a type that indicates that instances of this type can be serialized.
Using system;
Namespace clscommon
{
/// <Summary>
/// The person role summary contains the specified role.
/// </Summary>
[Serializable]
Public class person
{
Public string name;
Public String gender;
Public Person ()
{}
Public Person (string name, string gender)
{
Name = Name;
Gender = gender;
}
}
}
Used when you call the serialize or deserialize methods of the xmlserializer classXmlincludeattribute.
When the applicationXmlincludeattributeSpecify the type of the derived class.XmlserializerAfter serialization contains objects of both the base class and the derived class, it can recognize two types of objects.
However, when using a custom typeSerializableattributeAttribute is applied to a type that indicates that instances of this type can be serialized.
Using system;
Namespace clscommon
{
/// <Summary>
/// The person role summary contains the specified role.
/// </Summary>
[Serializable]
Public class person
{
Public string name;
Public String gender;
Public Person ()
{}
Public Person (string name, string gender)
{
Name = Name;
Gender = gender;
}
}
}
Used when you call the serialize or deserialize methods of the xmlserializer classXmlincludeattribute.
When the applicationXmlincludeattributeSpecify the type of the derived class.XmlserializerAfter serialization contains objects of both the base class and the derived class, it can recognize two types of objects.
However, when using a custom typeSerializableattributeAttribute is applied to a type that indicates that instances of this type can be serialized.
Using system;
Namespace clscommon
{
/// <Summary>
/// The person role summary contains the specified role.
/// </Summary>
[Serializable]
Public class person
{
Public string name;
Public String gender;
Public Person ()
{}
Public Person (string name, string gender)
{
Name = Name;
Gender = gender;
}
}
}