namespace Sandbox; /// /// Provides data about a wrapped property setter in a callback. /// /// The expected type of the wrapped property. public readonly ref struct WrappedPropertySet { /// /// The value the property wants to be set to. /// public T Value { get; init; } /// /// The object whose property is being wrapped. This will be null if we're wrapping a static property. /// public object Object { get; init; } /// /// Invoke the original setter with the provided value. /// public Action Setter { get; init; } /// /// Get the current value /// public Func Getter { get; init; } /// /// Is this a static property? /// public bool IsStatic { get; init; } /// /// The name of the type that the property belongs to. /// public string TypeName { get; init; } /// /// The name of the original property. If static, will return the full name including the type. /// public string PropertyName { get; init; } /// /// The identity of the original property. Used by TypeLibrary as a unique identifier for the property. /// public int MemberIdent { get; init; } /// /// An array of all attributes on the original property. /// public Attribute[] Attributes { get; init; } /// /// Get the attribute of type, or null if it doesn't exist /// public U GetAttribute() where U : System.Attribute { for ( int i = 0; i < Attributes.Length; i++ ) { if ( Attributes[i] is U t ) return t; } return default; } } /// /// Provides data about a wrapped property getter in a callback. /// /// The expected type of the wrapped property. public readonly ref struct WrappedPropertyGet { /// /// The value from the original getter. /// public T Value { get; init; } /// /// The object whose property is being wrapped. This will be null if we're wrapping a static property. /// public object Object { get; init; } /// /// Is this a static property? /// public bool IsStatic { get; init; } /// /// The name of the type that the property belongs to. /// public string TypeName { get; init; } /// /// The name of the original property. If static, will return the full name including the type. /// public string PropertyName { get; init; } /// /// The identity of the original property. Used by TypeLibrary as a unique identifier for the property. /// public int MemberIdent { get; init; } /// /// An array of all attributes on the original property. /// public Attribute[] Attributes { get; init; } /// /// Get the attribute of type, or null if it doesn't exist /// public U GetAttribute() where U : System.Attribute { for ( int i = 0; i < Attributes.Length; i++ ) { if ( Attributes[i] is U t ) return t; } return default; } }