Show / Hide Table of Contents

Interface IParameterSet

Interface that indicates that a class contains parameters and/or properties that are named.

Namespace: SpiceSharp.ParameterSets
Assembly: SpiceSharp.dll
Syntax
public interface IParameterSet
Remarks

Named parameters or properties are tagged with the attribute ParameterNameAttribute.

Methods

CreateParameterSetter<P>(string)

Creates an action that can set the parameter of the specified type and with the specified name.

Declaration
Action<P> CreateParameterSetter<P>(string name)
Parameters
Type Name Description
string name

The name of the parameter.

Returns
Type Description
Action<P>

An action that can set the parameter value, or null if the parameter could not be found.

Type Parameters
Name Description
P

The parameter value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

CreatePropertyGetter<P>(string)

Creates a function that can get the value of a property of the specified type and with the specified name.

Declaration
Func<P> CreatePropertyGetter<P>(string name)
Parameters
Type Name Description
string name

The name of the property.

Returns
Type Description
Func<P>

A function that can get the property value, or null if the property could not be found.

Type Parameters
Name Description
P

The property value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

GetProperty<P>(string)

Gets the value of a property of the specified type and with the specified name.

Declaration
P GetProperty<P>(string name)
Parameters
Type Name Description
string name

The name of the property.

Returns
Type Description
P

The value of the property.

Type Parameters
Name Description
P

The property value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

ParameterNotFoundException

Thrown if a parameter by the specified name could not be found.

SetParameter<P>(string, P)

Sets a parameter in the parameter set of the specified type and with the specified name.

Declaration
void SetParameter<P>(string name, P value)
Parameters
Type Name Description
string name

The name of the parameter.

P value

The value that the parameter should be set to.

Type Parameters
Name Description
P

The parameter value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

ParameterNotFoundException

Thrown if a parameter by the specified name could not be found.

TryGetProperty<P>(string, out P)

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

Declaration
bool TryGetProperty<P>(string name, out P value)
Parameters
Type Name Description
string name

The name of the property.

P value

The value of the property if the property was found.

Returns
Type Description
bool

true if the property was found and returned; otherwise, false.

Type Parameters
Name Description
P

The property value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

TrySetParameter<P>(string, P)

Tries to set a parameter in the parameter set of the specified type and with the specified name.

Declaration
bool TrySetParameter<P>(string name, P value)
Parameters
Type Name Description
string name

The name of the parameter.

P value

The value that the parameter should be set to.

Returns
Type Description
bool

true if a parameter was found and set succesfully; otherwise, false.

Type Parameters
Name Description
P

The parameter value type.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

Extension Methods

Documentation.ParameterValues<T>(IParameterSet, bool)
Documentation.Parameters(IParameterSet)
Utility.ThrowIfNull<T>(T, string)
In this article
Back to top Generated by DocFX