Show / Hide Table of Contents

Class TypedMemberMap<T>

A class that contains the members of a certain type.

Inheritance
System.Object
TypedMemberMap<T>
Implements
IParameterImporter<T>
IPropertyExporter<T>
IMemberMap
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: SpiceSharp.Reflection
Assembly: SpiceSharp.dll
Syntax
public class TypedMemberMap<T> : IParameterImporter<T>, IPropertyExporter<T>, IMemberMap
Type Parameters
Name Description
T

The base type.

Constructors

TypedMemberMap(IEqualityComparer<String>)

Initializes a new instance of the TypedMemberMap<T> class.

Declaration
public TypedMemberMap(IEqualityComparer<string> comparer)
Parameters
Type Name Description
System.Collections.Generic.IEqualityComparer<System.String> comparer

The comparer.

Properties

Comparer

Gets the comparer used to compare member names.

Declaration
public IEqualityComparer<string> Comparer { get; }
Property Value
Type Description
System.Collections.Generic.IEqualityComparer<System.String>

The comparer.

Members

Gets the members.

Declaration
public IEnumerable<MemberDescription> Members { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<MemberDescription>

The members.

Methods

Add(MemberDescription)

Adds a member description to the map.

Declaration
public void Add(MemberDescription member)
Parameters
Type Name Description
MemberDescription member

The member to add.

Exceptions
Type Condition
System.ArgumentException

Thrown if a member with the same name is already defined.

CreateGetter(Object, String)

Creates a getter for parameter with the specified name.

Declaration
public Func<T> CreateGetter(object source, string name)
Parameters
Type Name Description
System.Object source

The source object.

System.String name

The name of the parameter.

Returns
Type Description
System.Func<T>

The function that returns the parameter; or null if the parameter doesn't exist.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if name is null.

CreateSetter(Object, String)

Creates a setter for the parameter with the specified name.

Declaration
public Action<T> CreateSetter(object source, string name)
Parameters
Type Name Description
System.Object source

The source object.

System.String name

The name of the parameter.

Returns
Type Description
System.Action<T>

The action that sets the parameter; or null if the parameter does not exist.

TryGet(Object, String, out Boolean)

Tries getting the value of a parameter.

Declaration
public T TryGet(object source, string name, out bool isValid)
Parameters
Type Name Description
System.Object source

The source object.

System.String name

The name.

System.Boolean isValid

If set to true, the parameter was returned succesfully.

Returns
Type Description
T

The parameter value.

Remarks

This method does not follow the regular TryGet convention due to the interface being covariant.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if name is value.

TrySet(Object, String, T)

Tries setting a parameter value.

Declaration
public bool TrySet(object source, string name, T value)
Parameters
Type Name Description
System.Object source

The source object.

System.String name

The parameter name.

T value

The parameter value.

Returns
Type Description
System.Boolean

true if the parameter was set succesfully; otherwise false.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if name is null.

System.ArgumentException

Thrown if the value is invalid for the parameter.

Implements

IParameterImporter<T>
IPropertyExporter<T>
IMemberMap

Extension Methods

Utility.ThrowIfNull<T>(T, String)

See Also

IParameterImporter<T>
IPropertyExporter<T>
Back to top Generated by DocFX