ValueSerializer Class

Abstract class that defines conversion behavior for serialization from an object representation.

System.Object
  System.Windows.Markup.ValueSerializer
    More...

Namespace:  System.Windows.Markup
Assembly:  System.Xaml (in System.Xaml.dll)

'Declaration
Public MustInherit Class ValueSerializer

The ValueSerializer type exposes the following members.

  NameDescription
Protected methodValueSerializerInitializes a new instance of the ValueSerializer class.
Top

  NameDescription
Public methodCanConvertFromStringWhen overridden in a derived class, determines whether the specified String can be converted to an instance of the type that the implementation of ValueSerializer supports.
Public methodCanConvertToStringWhen overridden in a derived class, determines whether the specified object can be converted into a String.
Public methodConvertFromStringWhen overridden in a derived class, converts a String to an instance of the type that the implementation of ValueSerializer supports.
Public methodConvertToStringWhen overridden in a derived class, converts the specified object to a String.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Protected methodGetConvertFromExceptionReturns an exception to throw when a conversion cannot be performed.
Protected methodGetConvertToExceptionReturns an exception to throw when a conversion cannot be performed.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodStatic memberGetSerializerFor(PropertyDescriptor)Gets the ValueSerializer declared for a property, by passing a CLR property descriptor for the property.
Public methodStatic memberGetSerializerFor(Type)Gets the ValueSerializer declared for the specified type.
Public methodStatic memberGetSerializerFor(PropertyDescriptor, IValueSerializerContext)Gets the ValueSerializer declared for the specified property, using the specified context.
Public methodStatic memberGetSerializerFor(Type, IValueSerializerContext)Gets the ValueSerializer declared for the specified type, using the specified context.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTypeReferencesGets an enumeration of the types referenced by the ValueSerializer.
Top

The string a converter returns for serialization must be loss-less and the converter must always return the same string for a particular value. If a type converter (derived from TypeConverter) does not meet these requirements in its ConvertTo implementations for string output, a custom ValueSerializer must be declared. Either the ValueSerializer should meet the requirements, or a null ValueSerializer should be associated with the type. A ValueSerializer is associated with a type by applying the ValueSerializerAttribute attribute.

A null ValueSerializer indicates the type converter should be ignored for convert-to-string conversions from the object graph.

Important noteImportant

Implementation of ValueSerializer should avoid throwing exceptions. Any exceptions thrown could terminate serialization.

IValueSerializerContext for a ValueSerializer and its APIs is analogous to ITypeDescriptorContext for a TypeConverter. In fact, IValueSerializerContext inherits ITypeDescriptorContext. When a ValueSerializer derived class API is called, the caller (typically a serializer process) passes a context that may provide certain services. Because of the general guidance that a ValueSerializer must not throw exceptions. Failure to return a particular service from the context must also not throw any exceptions.

In previous versions of the .NET Framework, this class existed in the WPF-specific assembly WindowsBase. In .NET Framework 4, ValueSerializer is in the System.Xaml assembly. For more information, see Types Migrated from WPF to System.Xaml.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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

System.Object
  System.Windows.Markup.ValueSerializer
    Microsoft.VisualBasic.Activities.XamlIntegration.VisualBasicSettingsValueSerializer
    System.Activities.XamlIntegration.ActivityWithResultValueSerializer
    System.Activities.XamlIntegration.ArgumentValueSerializer
    System.Windows.Converters.Int32RectValueSerializer
    System.Windows.Converters.PointValueSerializer
    System.Windows.Converters.RectValueSerializer
    System.Windows.Converters.SizeValueSerializer
    System.Windows.Converters.VectorValueSerializer
    System.Windows.Input.KeyGestureValueSerializer
    System.Windows.Input.KeyValueSerializer
    System.Windows.Input.ModifierKeysValueSerializer
    System.Windows.Input.MouseActionValueSerializer
    System.Windows.Input.MouseGestureValueSerializer
    System.Windows.Markup.DateTimeValueSerializer
    System.Windows.Media.Converters.BrushValueSerializer
    System.Windows.Media.Converters.CacheModeValueSerializer
    System.Windows.Media.Converters.DoubleCollectionValueSerializer
    System.Windows.Media.Converters.GeometryValueSerializer
    System.Windows.Media.Converters.Int32CollectionValueSerializer
    System.Windows.Media.Converters.MatrixValueSerializer
    System.Windows.Media.Converters.PathFigureCollectionValueSerializer
    System.Windows.Media.Converters.PointCollectionValueSerializer
    System.Windows.Media.Converters.TransformValueSerializer
    System.Windows.Media.Converters.VectorCollectionValueSerializer
    System.Windows.Media.FontFamilyValueSerializer
    System.Windows.Media.ImageSourceValueSerializer
    System.Windows.Media.Media3D.Converters.Matrix3DValueSerializer
    System.Windows.Media.Media3D.Converters.Point3DCollectionValueSerializer
    System.Windows.Media.Media3D.Converters.Point3DValueSerializer
    System.Windows.Media.Media3D.Converters.Point4DValueSerializer
    System.Windows.Media.Media3D.Converters.QuaternionValueSerializer
    System.Windows.Media.Media3D.Converters.Rect3DValueSerializer
    System.Windows.Media.Media3D.Converters.Size3DValueSerializer
    System.Windows.Media.Media3D.Converters.Vector3DCollectionValueSerializer
    System.Windows.Media.Media3D.Converters.Vector3DValueSerializer
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft