Table of Contents

Class WrapMemberAttribute

Namespace
EzrSquared.Runtime.Types.Wrappers
Assembly
ezrSquared-lib.dll

Attribute for C# types and members to be automatically wrapped from C# types into ezr² types.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method|AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
public class WrapMemberAttribute : Attribute
Inheritance
object
Attribute
WrapMemberAttribute

Constructors

WrapMemberAttribute(bool, bool)

Creates a new WrapMemberAttribute.

public WrapMemberAttribute(bool isReadOnly = false, bool isWriteOnly = false)

Parameters

isReadOnly bool

Is the member read-only? Only for properties and fields.

isWriteOnly bool

Is the member write-only? Only for properties and fields.

Exceptions

ArgumentException

Thrown if both IsReadOnly and IsWriteOnly are set to true.

WrapMemberAttribute(string, bool, bool)

Creates a new WrapMemberAttribute.

public WrapMemberAttribute(string name, bool isReadOnly = false, bool isWriteOnly = false)

Parameters

name string

The ezr² name for the member.

isReadOnly bool

Is the member read-only? Only for properties and fields.

isWriteOnly bool

Is the member write-only? Only for properties and fields.

Fields

IsReadOnly

Is the member read-only? Only for properties and fields.

public readonly bool IsReadOnly

Field Value

bool

IsWriteOnly

Is the member write-only? Only for properties and fields.

public readonly bool IsWriteOnly

Field Value

bool

Name

The ezr² name for the member.

public readonly string Name

Field Value

string

Methods

GetIsPublic(MemberInfo)

Is the member publicly accessible in some way?

public static bool GetIsPublic(MemberInfo member)

Parameters

member MemberInfo

The member to check.

Returns

bool

true if yes, false otherwise.

Exceptions

ArgumentException

If member is of an unknown or unsupported type.

ShouldBeWrapped(MemberInfo)

Is the member eligible to be wrapped?

public static bool ShouldBeWrapped(MemberInfo member)

Parameters

member MemberInfo

The member to be wrapped.

Returns

bool

true if yes, false otherwise.

ValidateMethod(MethodBase, bool)

Checks if the given method has the supported signature for wrapping.

public static bool ValidateMethod(MethodBase methodBase, bool dontThrow = false)

Parameters

methodBase MethodBase

The method.

dontThrow bool

Disable exception throwing.

Returns

bool

true if valid, an exception or false otherwise.

Exceptions

ArgumentException

Thrown if the method is generic or has generic parameters.

ValidateType(Type, bool)

Checks if the given type has the supported signature for wrapping.

public static bool ValidateType(Type type, bool dontThrow = false)

Parameters

type Type

The type.

dontThrow bool

Disable exception throwing.

Returns

bool

true if valid, an exception or false otherwise.

Exceptions

ArgumentException

Thrown if the type is generic or has generic parameters.