System.Runtime.Serialization 4.0.0.0

Use the when using the if you need to do one of the following: substitute one type or object for another, or to dynamically generate schema variations. For a sample application, see DataContract Surrogate Sample. For more information about data contracts, see Using Data Contracts.

At run time, you can find the specific for any operation in a service by using the to find the instance. For more information about implementing the interface to create a surrogate, see Data Contract Surrogates.

You can also use the to affect the import and export of XML schemas when you are using the and classes. You can do so by assigning the to the property of the class, or to the property of the class. For more information, see Schema Import and Export.

Provides the methods needed to substitute one type for another by the during serialization, deserialization, and export and import of XML schema documents (XSD).

- Method
  4.0.0.0
  System.Object `` `` To be added.

  During schema export operations, inserts annotations into the schema for non-null return values.

  An object that represents the annotation to be inserted into the XML schema definition.

  A that describes the member. A .
- Method
  4.0.0.0
  System.Object `` `` To be added.

  During schema export operations, inserts annotations into the schema for non-null return values.

  An object that represents the annotation to be inserted into the XML schema definition.

  The CLR type to be replaced. The data contract type to be annotated.
- Method
  4.0.0.0
  System.Type `` To be added.

  During serialization, deserialization, and schema import and export, returns a data contract type that substitutes the specified type.

  The to substitute for the value. This type must be serializable by the . For example, it must be marked with the attribute or other mechanisms that the serializer recognizes.

  The CLR type to substitute.
- Method
  4.0.0.0
  System.Object `` ``

  In a simple implementation, use an if…then…else control structure to test whether the value is of the surrogated type. If so, transform it as necessary and return the substituted object. The substituted object can be a new instance or the same instance.

  During deserialization, returns an object that is a substitute for the specified object.

  The substituted deserialized object. This object must be of a type that is serializable by the . For example, it must be marked with the attribute or other mechanisms that the serializer recognizes.

  The deserialized object to be substituted. The that the substituted object should be assigned to.
- Method
  4.0.0.0
  System.Void ``

  This method is required during schema export or schema import only if annotations are inserted into the schema using the method.

  Sets the collection of known types to use for serialization and deserialization of the custom data objects.

  A of to add known types to.
- Method
  4.0.0.0
  System.Object `` ``

  This method must not return null because on deserialization the data will be cast to type and an is thrown.

  During serialization, returns an object that substitutes the specified object.

  The substituted object that will be serialized. The object must be serializable by the . For example, it must be marked with the attribute or other mechanisms that the serializer recognizes.

  The object to substitute. The that the substituted object should be assigned to.
- Method
  4.0.0.0
  System.Type `` `` ``

  Null should be returned if a CLR type does not exist for representing the schema type. This will cause a new type to be generated during schema import.

  During schema import, returns the type referenced by the schema.

  The to use for the referenced type.

  The name of the type in schema. The namespace of the type in schema. The object that represents the annotation inserted into the XML schema definition, which is data that can be used for finding the referenced type.
- Method
  4.0.0.0
  System.CodeDom.CodeTypeDeclaration `` ``

  The input or other information in the can be modified by the user in this method. If null is returned, it will cause the type to not be generated. If a new is returned, it will replace the original type generated.

  Processes the type that has been generated from the imported schema.

  A that contains the processed type.

  A to process that represents the type declaration generated during schema import. The that contains the other code generated during schema import.