Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SerializationContext Class

Defines the context of a serialization operation.


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

public sealed class SerializationContext

The SerializationContext type exposes the following members.

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

Public propertyDirectoryA serializer instance needs to look up for other serializer instances during serialization/deserialization, so this directory provides the lookup service.
Public propertyItemIndexer 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 propertyLocationIn 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 propertyResultThis is the SerializationResult collected from all serializers participating in the current serialization operation.
Public propertyWriteOptionalPropertiesWithDefaultValueWhether optional properties with default value should be written out during serialization.

Public methodEqualsDetermines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public fieldStatic memberTransactionContextKeyUnique key used to identify SerializationContext instances in the TransactionContext property bag

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.

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