SerializationContext Class

Defines the context of a serialization operation.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Modeling.SerializationContext

Namespace:  Microsoft.VisualStudio.Modeling
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.12.0.dll)

Syntax

'Declaration
Public NotInheritable Class SerializationContext
public sealed class SerializationContext
public ref class SerializationContext sealed
[<Sealed>]
type SerializationContext =  class end
public final class SerializationContext

The SerializationContext type exposes the following members.

Constructors

  Name Description
Public method SerializationContext(DomainXmlSerializerDirectory) Create a serialization context with no source/destination location information.
Public method SerializationContext(DomainXmlSerializerDirectory, String) Create a serialization context with given source/destination location.
Public method SerializationContext(DomainXmlSerializerDirectory, String, SerializationResult) Create a serialization context with given source/destination location and SeralizationResult.

Top

Properties

  Name Description
Public property Directory A serializer instance needs to look up for other serializer instances during serialization/deserialization, so this directory provides the lookup service.
Public property Item Indexer to access properties stored in this context. The property name is compared by case-sensitive ordinal string comparison. If a property already exists in the context, setting it will override the old value with the new value. If a property doesn't exist in the context, getting it will return null, therefore setting a property to null will remove it from the context (i.e. null and non-existing values are not distinguishable).
Public property Location In read operation, this is the source's location; in write operation, this is the destination location. Usually this is a file path, but it can be other format as well, depending on the underlying source/destination. It can be null as well if the location is not available, e.g. serializing to a string buffer.
Public property Result This is the SerializationResult collected from all serializers participating in the current serialization operation.
Public property WriteOptionalPropertiesWithDefaultValue Whether optional properties with default value should be written out during serialization.

Top

Methods

  Name Description
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Fields

  Name Description
Public fieldStatic member TransactionContextKey Unique key used to identify SerializationContext instances in the TransactionContext property bag

Top

Remarks

The context is passed to each participating serializer and provides information that can be used during serialization. The context also stores the results that are collected after serialization.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Modeling Namespace