Table of Contents

Class ContentSerializerAttribute

Namespace
Microsoft.Xna.Framework.Content
Assembly
MonoGame.Framework.dll

Defines a custom Attribute that marks a field or property to control how it is serialized or to indicate that protected or private data should be included in serialization.

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field)]
public sealed class ContentSerializerAttribute : Attribute
Inheritance
ContentSerializerAttribute
Inherited Members

Constructors

ContentSerializerAttribute()

Initializes a new instance of the content serializer attribute.

public ContentSerializerAttribute()

Properties

AllowNull

Gets or Sets a value that indicates whether this member can have a null value (default is true).

public bool AllowNull { get; set; }

Property Value

bool

CollectionItemName

Gets or Sets the XML element name for each item in a collection (default is "Item").

public string CollectionItemName { get; set; }

Property Value

string

ElementName

Gets or Sets the XML element name (default is the name of the managed type member).

public string ElementName { get; set; }

Property Value

string

FlattenContent

Gets or Sets a value indicating whether to write member contents directly into the current XML context rather than wrapping the member in a new XML element (default is false).

public bool FlattenContent { get; set; }

Property Value

bool

HasCollectionItemName

Gets a value that indicates whether an explicit CollectionItemName is being used or the default value.

public bool HasCollectionItemName { get; }

Property Value

bool

Optional

Gets or Sets a value indicating whether to write this element if the member is null and skip past it if not found when deserializing XML (default is false).

public bool Optional { get; set; }

Property Value

bool

SharedResource

Gets or Sets a value indicating whether this member is reference from multiple parents and should be serialized as a unique ID reference (default is false).

public bool SharedResource { get; set; }

Property Value

bool

Methods

Clone()

Creates a copy of this content serializer attribute.

public ContentSerializerAttribute Clone()

Returns

ContentSerializerAttribute

The copy of this content serializer attribute.