FormatterTypeStyle 枚举


指示类型说明在序列化流中的布局格式。Indicates the format in which type descriptions are laid out in the serialized stream.

public enum class FormatterTypeStyle
public enum FormatterTypeStyle
type FormatterTypeStyle = 
Public Enum FormatterTypeStyle


TypesAlways 1

指示类型可以提供给所有对象成员和 ISerializable 对象成员。Indicates that types can be given to all object members and ISerializable object members.

TypesWhenNeeded 0

指示只能为对象数组、Object 类型的对象成员和 ISerializable 非基元值类型声明类型。Indicates that types can be stated only for arrays of objects, object members of type Object, and ISerializable non-primitive value types.

XsdString 2

指示可以采用 XSD 格式(而不是 SOAP 格式)来提供字符串。Indicates that strings can be given in the XSD format rather than SOAP. 不传输任何字符串 ID。No string IDs are transmitted.


XsdStringTypesWhenNeeded设置用于在 particular.NET 实现的相同版本上构建的服务之间进行高性能的序列化。The XsdString and TypesWhenNeeded settings are meant for high performance serialization between services built on the same version of a particular.NET implementation. 这两个值不支持VTS (版本容错序列化) , 因为它们有意省略了 VTS 用于跳过或添加可选字段和属性的类型信息。These two values do not support VTS (Version Tolerant Serialization) because they intentionally omit type information that VTS uses to skip or add optional fields and properties. 在运行不同版本的XsdString .net TypesWhenNeeded实现的计算机上序列化和反序列化类型时, 不应使用或类型格式, 而不应使用序列化该类型的计算机。You should not use the XsdString or TypesWhenNeeded type formats when serializing and deserializing types on a computer running a different version of the .NET implementation than the computer on which the type was serialized. 在运行不同版本的 .NET 实现的计算机上进行序列化和反序列化会导致格式化程序跳过类型信息的序列化, 因此, 如果反序列化程序不存在于中, 则反序列化程序无法跳过这些字段可能存在于 .NET 实现的其他版本中的某些类型。Serializing and deserializing on computers running different versions of a .NET implementation causes the formatter to skip serialization of type information, thus making it impossible for the deserializer to skip optional fields if they are not present in certain types that may exist in the other version of the .NET implementation. 如果在这种XsdString情况TypesWhenNeeded下必须使用或, 则必须为从一个版本更改到另一个版本的类型提供自定义序列化。If you must use XsdString or TypesWhenNeeded in such a scenario, you must provide custom serialization for types that have changed from one version to the other.