Table of Contents

Interface IMethodShape

Namespace
PolyType.Abstractions
Assembly
PolyType.dll

Provides a strongly typed shape model for a given .NET method.

public interface IMethodShape

Properties

AttributeProvider

Gets the provider used for method-level attribute resolution.

ICustomAttributeProvider? AttributeProvider { get; }

Property Value

ICustomAttributeProvider

DeclaringType

Gets the shape of the declaring type for the method.

ITypeShape DeclaringType { get; }

Property Value

ITypeShape

IsAsync

Gets a value indicating whether the underlying method returns a Task or ValueTask.

bool IsAsync { get; }

Property Value

bool

IsPublic

Gets a value indicating whether the method is declared public.

bool IsPublic { get; }

Property Value

bool

IsStatic

Gets a value indicating whether the method is static.

bool IsStatic { get; }

Property Value

bool

IsVoidLike

Gets a value indicating whether the underlying method returns void, Task, or ValueTask.

bool IsVoidLike { get; }

Property Value

bool

Remarks

When true the ReturnType is reported as Unit,

Name

Gets the name of the method.

string Name { get; }

Property Value

string

Parameters

Gets the shapes of the parameters accepted by the method.

IReadOnlyList<IParameterShape> Parameters { get; }

Property Value

IReadOnlyList<IParameterShape>

ReturnType

Gets the shape of the return type of the method.

ITypeShape ReturnType { get; }

Property Value

ITypeShape

Methods

Accept(TypeShapeVisitor, object?)

Accepts an TypeShapeVisitor for strongly-typed traversal.

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

Parameters

visitor TypeShapeVisitor

The visitor to accept.

state object

The state parameter to pass to the underlying visitor.

Returns

object

The object result returned by the visitor.