Table of Contents

Class SourceGenPropertyShape<TDeclaringType, TPropertyType>

Namespace
PolyType.SourceGenModel
Assembly
PolyType.dll

Source generator model for a property shape.

public sealed class SourceGenPropertyShape<TDeclaringType, TPropertyType> : IPropertyShape<TDeclaringType, TPropertyType>, IPropertyShape

Type Parameters

TDeclaringType

The declaring type of the property.

TPropertyType

The type of the property value.

Inheritance
SourceGenPropertyShape<TDeclaringType, TPropertyType>
Implements
IPropertyShape<TDeclaringType, TPropertyType>
Inherited Members

Properties

AttributeProviderFunc

Gets the custom attribute provider for the property.

public Func<ICustomAttributeProvider?>? AttributeProviderFunc { get; init; }

Property Value

Func<ICustomAttributeProvider>

DeclaringType

Gets the shape of the declaring type.

public required IObjectTypeShape<TDeclaringType> DeclaringType { get; init; }

Property Value

IObjectTypeShape<TDeclaringType>

Getter

Gets the getter delegate for the property.

public Getter<TDeclaringType, TPropertyType>? Getter { get; init; }

Property Value

Getter<TDeclaringType, TPropertyType>

IsField

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

public bool IsField { get; init; }

Property Value

bool

IsGetterNonNullable

Gets a value indicating whether the getter returns non-null values.

public required bool IsGetterNonNullable { get; init; }

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.

public required bool IsGetterPublic { get; init; }

Property Value

bool

IsSetterNonNullable

Gets a value indicating whether the setter requires non-null values.

public required bool IsSetterNonNullable { get; init; }

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.

public required bool IsSetterPublic { get; init; }

Property Value

bool

Name

Gets the name of the property.

public required string Name { get; init; }

Property Value

string

Position

Gets the 0-indexed position of the current property.

public required int Position { get; init; }

Property Value

int

PropertyType

Gets the shape of the property type.

public required ITypeShape<TPropertyType> PropertyType { get; init; }

Property Value

ITypeShape<TPropertyType>

Setter

Gets the setter delegate for the property.

public Setter<TDeclaringType, TPropertyType>? Setter { get; init; }

Property Value

Setter<TDeclaringType, TPropertyType>