Table of Contents

Interface IPropertyShape

Namespace
PolyType.Abstractions
Assembly
PolyType.dll

Provides a strongly typed shape model for a given .NET instance property or field.

public interface IPropertyShape

Properties

AttributeProvider

The provider used for property-level attribute resolution.

ICustomAttributeProvider? AttributeProvider { get; }

Property Value

ICustomAttributeProvider

DeclaringType

The shape of the declaring type.

IObjectTypeShape DeclaringType { get; }

Property Value

IObjectTypeShape

HasGetter

Specifies whether the property has an accessible getter.

bool HasGetter { get; }

Property Value

bool

HasSetter

Specifies whether the property has an accessible setter.

bool HasSetter { get; }

Property Value

bool

IsField

Specifies whether the shape represents a .NET field.

bool IsField { get; }

Property Value

bool

IsGetterNonNullable

Specifies whether the getter returns non-null values.

bool IsGetterNonNullable { get; }

Property Value

bool

Remarks

Returns true if the property type is a non-nullable struct, a non-nullable reference type or the property has been annotated with the NotNullAttribute.

Conversely, it could return false if a non-nullable property has been annotated with MaybeNullAttribute.

IsGetterPublic

Specifies whether the property getter is declared public.

bool IsGetterPublic { get; }

Property Value

bool

IsSetterNonNullable

Specifies whether the setter requires non-null values.

bool IsSetterNonNullable { get; }

Property Value

bool

Remarks

Returns true if the property type is a non-nullable struct, a non-nullable reference type or the property has been annotated with the DisallowNullAttribute.

Conversely, it could return false if a non-nullable property has been annotated with AllowNullAttribute.

IsSetterPublic

Specifies whether the property setter is declared public.

bool IsSetterPublic { get; }

Property Value

bool

Name

The name of the property.

string Name { get; }

Property Value

string

PropertyType

The shape of the property type.

ITypeShape PropertyType { get; }

Property Value

ITypeShape

Methods

Accept(ITypeShapeVisitor, object?)

Accepts an ITypeShapeVisitor for strongly typed traversal.

object? Accept(ITypeShapeVisitor visitor, object? state = null)

Parameters

visitor ITypeShapeVisitor

The visitor to accept.

state object

The state parameter to pass to the underlying visitor.

Returns

object

The object result returned by the visitor.