Class BaseTypeCollection<TBaseItemType>
public class BaseTypeCollection<TBaseItemType>
Inheritance
Inherited Members
Namespace: HomeSeer.PluginSdk.Events
Assembly: PluginSdk.dll
A collection for holding types of classes that adhere to certain structural rules.
Type Parameters
Name | Description |
---|---|
TBaseItemType | The type of item to manage |
Fields
View Source_itemTypeNames
System.Collections.Generic.HashSet<T> of class names representing the System.Type in _itemTypes
Declaration
HashSet<string> _itemTypeNames
Field Value
Type | Description |
---|---|
System.Collections.Generic.HashSet<System.String> |
_itemTypes
System.Collections.Generic.List<T> of System.Type that are a subclass of TBaseItemType
Declaration
protected List<Type> _itemTypes
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Type> |
Properties
View SourceConstructorSignatures
A System.Collections.Generic.List<T> of constructor signatures
Declaration
protected List<Type[]> ConstructorSignatures { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Type[]> |
Count
The number of types that are supported by the collection
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
MatchAllSignatures
Whether the items in the collection must match all of the listed ConstructorSignatures or just one. true if the items must match all constructor signatures.
Declaration
protected bool MatchAllSignatures { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
View SourceAddItemType(Type)
Add the specified class type that derives from TBaseItemType
to the list of item types
Declaration
protected void AddItemType(Type itemType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | itemType | The System.Type of the class that derives from |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the specified class type will not work as the desired type |
AssertTypeHasConstructor(Type, Type[])
Declaration
static void AssertTypeHasConstructor(Type targetType, Type[] constructorParams)
Parameters
Type | Name | Description |
---|---|---|
System.Type | targetType | |
System.Type[] | constructorParams |
AssertTypeHasConstructors(Type)
Declaration
void AssertTypeHasConstructors(Type targetType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | targetType |
AssertTypeHasEmptyConstructor(Type)
Declaration
void AssertTypeHasEmptyConstructor(Type targetType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | targetType |
GetObjectFromInfo(Int32)
Get an instance of an object of the type defined at a specific index in the collection
Declaration
protected TBaseItemType GetObjectFromInfo(int itemIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | itemIndex | The index of the type to use |
Returns
Type | Description |
---|---|
TBaseItemType |
Exceptions
Type | Condition |
---|---|
System.Collections.Generic.KeyNotFoundException | Thrown when no item is found at the specified index |
System.TypeLoadException | Thrown when there was an error while creating an instance of the specified type |
GetObjectFromInfo(Int32, Int32, Object[])
Get an instance of an object of the type defined at a specific index in the collection
Declaration
protected TBaseItemType GetObjectFromInfo(int itemIndex, int signatureIndex, params object[] inParams)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | itemIndex | The index of the type to use |
System.Int32 | signatureIndex | The index of the constructor signature to use |
System.Object[] | inParams | The parameters to pass to the constructor |
Returns
Type | Description |
---|---|
TBaseItemType |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when there was an issue with the provided parameters |
TypeHasConstructor(Int32, Int32)
Determine if a specific type has a particular constructor signature defined
Declaration
protected bool TypeHasConstructor(int itemIndex, int signatureIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | itemIndex | The index of the type to use |
System.Int32 | signatureIndex | The index of the constructor signature to use |
Returns
Type | Description |
---|---|
System.Boolean | true if the type has the specific constructor defined |
Exceptions
Type | Condition |
---|---|
System.Collections.Generic.KeyNotFoundException | Thrown if a type or signature was not found at the specified index |