Optional Class

The factory of the SchemaType object that represents the child element that occurs once or not at all.

C#
public static class Optional
Inheritance
Optional

Methods

Of<T>()

Creates the SchemaType object that represents the child element corresponding to the specified class that occurs once or not at all.

Methods Detail

Of<T>()

Creates the SchemaType object that represents the child element corresponding to the specified class that occurs once or not at all.

C#
public static SchemaType Of<T>()

Type Parameters

T
class

The class annotated with ForElementAttribute, representing the child element that occurs once or not at all.

Returns

The SchemaType object.

Remarks

The SchemaType object for the specified class that this method returns must not follow consecutively one that Multiple.Of<T>() with the same class returns, in the parameters of the Schema.Of(SchemaType[]). For example, Schema.Of(Multiple.Of<Movie>(), Optional.Of<Movie>()) is invalid.