Show / Hide Table of Contents

Class ParameterMap

A cached map of type members. Can be used to map parameter names to MemberDescription instances.

Inheritance
System.Object
ParameterMap
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 ParameterMap

Constructors

ParameterMap(Type, IEqualityComparer<String>)

Initializes a new instance of the ParameterMap class.

Declaration
public ParameterMap(Type type, IEqualityComparer<string> comparer)
Parameters
Type Name Description
System.Type type

The type.

System.Collections.Generic.IEqualityComparer<System.String> comparer

The comparer used.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if type is null.

Properties

Comparer

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

Members

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

Methods

CreateGetter<P>(Object, String)

Creates a getter for a property with the specified name.

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

The source.

System.String name

The property name.

Returns
Type Description
System.Func<P>

The getter; or null if the property was not found.

Type Parameters
Name Description
P

The property value type.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if name is null.

CreateSetter<P>(Object, String)

Creates a setter for a parameter with the specified name.

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

The source.

System.String name

The parameter name.

Returns
Type Description
System.Action<P>

The setter; or null if the parameter was not found.

Type Parameters
Name Description
P

The parameter value type.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if name is null.

Remap(IEqualityComparer<String>)

Remaps the parameter map using a new comparer.

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

The comparer.

TryGet<P>(Object, String, out P)

Tries to get the value of a property with the specified name.

Declaration
public bool TryGet<P>(object source, string name, out P value)
Parameters
Type Name Description
System.Object source

The source.

System.String name

The name.

P value

The value.

Returns
Type Description
System.Boolean

true if the property was found; otherwise, false.

Type Parameters
Name Description
P

The property value type.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if name is null.

TrySet<P>(Object, String, P)

Tries to set the value of a parameter with the specified name.

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

The source.

System.String name

The name.

P value

The value.

Returns
Type Description
System.Boolean

true if the parameter was set succesfully; otherwise false.

Type Parameters
Name Description
P

The parameter value type.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if name is null.

Extension Methods

Utility.ThrowIfNull<T>(T, String)
Back to top Generated by DocFX