Table of Contents

Class TypeShapeAttribute

Namespace
PolyType
Assembly
PolyType.dll

Configures the generated ITypeShape of the annotated type.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
public sealed class TypeShapeAttribute : Attribute
Inheritance
TypeShapeAttribute
Inherited Members

Properties

IncludeMethods

Gets the binding flags that determine what method shapes should be included in the type shape.

public MethodShapeFlags IncludeMethods { get; init; }

Property Value

MethodShapeFlags

Remarks

If left unspecified, only methods annotated with MethodShapeAttribute will be included.

This type can only be used to control inclusion of public methods in the shape models. Non-public methods can only be included individually via explicit MethodShapeAttribute annotations.

Kind

Gets the kind that should be generated for the annotated type.

public TypeShapeKind Kind { get; init; }

Property Value

TypeShapeKind

Remarks

Passing None will result in the generation of an IObjectTypeShape that does not contain any properties or constructors.

Exceptions

ArgumentOutOfRangeException

The specified value is not a valid TypeShapeKind.

Marshaler

Gets a type implementing an IMarshaler<TSource, TTarget> to a surrogate type.

public Type? Marshaler { get; init; }

Property Value

Type

Remarks

The type should have a parameterless constructor and must implement IMarshaler<TSource, TTarget> where either of the two generic types should match the annotated type.

Types that specify a Marshaler will be of shape ISurrogateTypeShape.