Show / Hide Table of Contents

Interface ITypeSet<V>

A set of instances that can also be found by their type.

Inherited Members
ICollection<V>.Add(V)
ICollection<V>.Clear()
ICollection<V>.Contains(V)
ICollection<V>.CopyTo(V[], int)
ICollection<V>.Remove(V)
ICollection<V>.Count
ICollection<V>.IsReadOnly
IEnumerable<V>.GetEnumerator()
Namespace: SpiceSharp.General
Assembly: SpiceSharp.dll
Syntax
public interface ITypeSet<V> : ICollection<V>, IEnumerable<V>, IEnumerable
Type Parameters
Name Description
V

The base value type.

Methods

ContainsType(Type)

Determines whether this instance contains a value of the specified type.

Declaration
bool ContainsType(Type key)
Parameters
Type Name Description
Type key

The key.

Returns
Type Description
bool

true if the specified key contains type; otherwise, false.

Exceptions
Type Condition
ArgumentNullException

Thrown if key is null.

ContainsType<TResult>()

Determines whether this instance contains a value of the specified type.

Declaration
bool ContainsType<TResult>() where TResult : V
Returns
Type Description
bool

true if this instance contains type; otherwise, false.

Type Parameters
Name Description
TResult

The type of the result.

GetValue<TResult>()

Gets a value from the set with the specified type.

Declaration
TResult GetValue<TResult>() where TResult : V
Returns
Type Description
TResult

The value.

Type Parameters
Name Description
TResult

The result type.

Exceptions
Type Condition
AmbiguousTypeException

Thrown if the type could not be resolved to a single instance.

TryGetValue<TResult>(out TResult)

Tries getting a value from the set with the specified type.

Declaration
bool TryGetValue<TResult>(out TResult value) where TResult : V
Parameters
Type Name Description
TResult value

The value.

Returns
Type Description
bool

true if the value was found; otherwise, false.

Type Parameters
Name Description
TResult

The result type.

Exceptions
Type Condition
AmbiguousTypeException

Thrown if the type could not be resolved to a single instance.

Events

TypeNotFound

Occurs if a type could not be found.

Declaration
event EventHandler<TypeNotFoundEventArgs<V>> TypeNotFound
Event Type
Type Description
EventHandler<TypeNotFoundEventArgs<V>>

Extension Methods

Utility.ThrowIfNull<T>(T, string)
Utility.ThrowIfEmpty<T>(IEnumerable<T>, string)
In this article
Back to top Generated by DocFX