Table of Contents

Interface IEventShape

Namespace
PolyType.Abstractions
Assembly
PolyType.dll

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

public interface IEventShape

Properties

AttributeProvider

Gets the provider used for event-level attribute resolution.

IGenericCustomAttributeProvider AttributeProvider { get; }

Property Value

IGenericCustomAttributeProvider

Remarks

Provides fast attribute resolution when using the source generator, otherwise this is wrapping standard reflection-based attribute resolution.

When using the source generator, the following categories of attributes are excluded to reduce trimmed application size:

  • System.Runtime.CompilerServices.* - Compiler-generated attributes
  • System.Runtime.InteropServices.* - COM interop attributes
  • System.Diagnostics.* - Diagnostic attributes
  • System.Reflection.DefaultMemberAttribute - Default member metadata
  • System.CLSCompliantAttribute - CLS compliance marker
  • Microsoft.FSharp.Core.* - F# compiler generated attributes
  • Attributes marked with unmet ConditionalAttribute annotations
Users requiring complete attribute resolution can use the EventInfo property to access standard reflection-based attribute APIs, though this will be slower.

DeclaringType

Gets the shape of the declaring type.

ITypeShape DeclaringType { get; }

Property Value

ITypeShape

EventInfo

Gets the underlying EventInfo representing the event, if available.

EventInfo? EventInfo { get; }

Property Value

EventInfo

HandlerType

Gets the shape of the event handler type.

IFunctionTypeShape HandlerType { get; }

Property Value

IFunctionTypeShape

IsPublic

Gets a value indicating whether the add method is declared public.

bool IsPublic { get; }

Property Value

bool

IsStatic

Gets a value indicating whether the event is static.

bool IsStatic { get; }

Property Value

bool

Name

Gets the name of the event.

string Name { get; }

Property Value

string

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.