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
-
objectAttributeWrapMemberAttribute
Constructors
WrapMemberAttribute(bool, bool)
Creates a new WrapMemberAttribute.
public WrapMemberAttribute(bool isReadOnly = false, bool isWriteOnly = false)
Parameters
isReadOnly
boolIs the member read-only? Only for properties and fields.
isWriteOnly
boolIs 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
stringThe ezr² name for the member.
isReadOnly
boolIs the member read-only? Only for properties and fields.
isWriteOnly
boolIs 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
MemberInfoThe member to check.
Returns
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
MemberInfoThe member to be wrapped.
Returns
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
MethodBaseThe method.
dontThrow
boolDisable exception throwing.
Returns
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
TypeThe type.
dontThrow
boolDisable exception throwing.
Returns
Exceptions
- ArgumentException
Thrown if the type is generic or has generic parameters.