Class MemberDescription
The description of a member on a type with named parameters.
Inheritance
Inherited Members
Namespace: SpiceSharp.Reflection
Assembly: SpiceSharp.dll
Syntax
public class MemberDescription
Constructors
MemberDescription(MemberInfo)
Initializes a new instance of the MemberDescription class.
Declaration
public MemberDescription(MemberInfo member)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Reflection.MemberInfo | member | The member. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown if |
Properties
Description
Gets the description of the parameter.
Declaration
public string Description { get; }
Property Value
| Type | Description |
|---|---|
| System.String | The description of the parameter. |
Interesting
Gets a value indicating whether this member is interesting.
Declaration
public bool Interesting { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
IsPrincipal
Gets a value indicating whether this instance is principal.
Declaration
public bool IsPrincipal { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
IsStatic
Gets a value indicating whether the member is static.
Declaration
public bool IsStatic { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Member
Gets the member.
Declaration
public MemberInfo Member { get; }
Property Value
| Type | Description |
|---|---|
| System.Reflection.MemberInfo | The member. |
Names
Gets the names.
Declaration
public IReadOnlyList<string> Names { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyList<System.String> | The names. |
ParameterType
Gets the type for setting the parameter value.
Declaration
public Type ParameterType { get; }
Property Value
| Type | Description |
|---|---|
| System.Type | The type that can be used for setting the member value. |
Remarks
A parameter is a named quantity that can be specified by the user.
PropertyType
Gets the type for getting the property value.
Declaration
public Type PropertyType { get; }
Property Value
| Type | Description |
|---|---|
| System.Type | The type that can be used for getting the member value. |
Remarks
A property is a named quantity that can be asked by the user.
Methods
CreateGetter<P>(Object)
Creates a getter for the member.
Declaration
public Func<P> CreateGetter<P>(object source)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | source | The source object. |
Returns
| Type | Description |
|---|---|
| System.Func<P> | The function that will return the parameter value, or null if the parameter can't be returned. |
Type Parameters
| Name | Description |
|---|---|
| P | The parameter type. |
CreateSetter<P>(Object)
Creates a setter for the member.
Declaration
public Action<P> CreateSetter<P>(object source)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | source | The source object. |
Returns
| Type | Description |
|---|---|
| System.Action<P> | The action that can set the parameter, or null if the parameter can't be set. |
Type Parameters
| Name | Description |
|---|---|
| P | The parameter type. |
ToString()
Returns a string that represents the current member description.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | A string that represents the current member description. |
Overrides
TryGet<P>(Object, out P)
Tries getting the value of the member.
Declaration
public bool TryGet<P>(object source, out P value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | source | The source object. |
| P | value | The value. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Type Parameters
| Name | Description |
|---|---|
| P | The parameter type. |
Exceptions
| Type | Condition |
|---|---|
| System.Reflection.TargetException | Thrown if |
| System.Reflection.TargetInvocationException | Thrown if the invoked get method throws an exception. |
TrySet<P>(Object, P)
Tries setting the member to a specified value.
Declaration
public bool TrySet<P>(object source, P value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | source | The source object. |
| P | value | The value. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Type Parameters
| Name | Description |
|---|---|
| P | The parameter type. |
Exceptions
| Type | Condition |
|---|---|
| System.Reflection.TargetException | Thrown if |
| System.Reflection.TargetInvocationException | Thrown if the invoked get method throws an exception. |