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

Gets the provider used for property-level attribute resolution.

ICustomAttributeProvider? AttributeProvider { get; }

Property Value

ICustomAttributeProvider

DeclaringType

Gets the shape of the declaring type.

IObjectTypeShape DeclaringType { get; }

Property Value

IObjectTypeShape

HasGetter

Gets a value indicating whether the property has an accessible getter.

bool HasGetter { get; }

Property Value

bool

HasSetter

Gets a value indicating whether the property has an accessible setter.

bool HasSetter { get; }

Property Value

bool

IsField

Gets a value indicating whether the shape represents a .NET field.

bool IsField { get; }

Property Value

bool

IsGetterNonNullable

Gets a value indicating 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

Gets a value indicating whether the property getter is declared public.

bool IsGetterPublic { get; }

Property Value

bool

IsSetterNonNullable

Gets a value indicating 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

Gets a value indicating whether the property setter is declared public.

bool IsSetterPublic { get; }

Property Value

bool

Name

Gets the name of the property.

string Name { get; }

Property Value

string

PropertyType

Gets 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.