Class LedMapping<T>
Represents a mapping from LedId to a custom identifier.
Inherited Members
Namespace: RGB.NET.Core
Assembly: RGB.NET.Core.dll
Syntax
public sealed class LedMapping<T> : IEnumerable<(LedId ledId, T mapping)>, IEnumerable where T : notnullType Parameters
| Name | Description | 
|---|---|
| T | The identifier the LedId is mapped to. | 
Properties
| Edit this page View SourceCount
Gets the number of entries in this mapping.
Declaration
public int Count { get; }Property Value
| Type | Description | 
|---|---|
| int | 
Empty
Declaration
public static LedMapping<T> Empty { get; }Property Value
| Type | Description | 
|---|---|
| LedMapping<T> | 
this[LedId]
Gets the custom identifier mapped to the specified LedId.
Declaration
public T this[LedId ledId] { get; set; }Parameters
| Type | Name | Description | 
|---|---|---|
| LedId | ledId | The led id to get the mapped identifier. | 
Property Value
| Type | Description | 
|---|---|
| T | The mapped ifentifier. | 
this[T]
Gets the LedId mapped to the specified custom identifier.
Declaration
public LedId this[T mapping] { get; set; }Parameters
| Type | Name | Description | 
|---|---|---|
| T | mapping | The custom identifier to get the mapped led id. | 
Property Value
| Type | Description | 
|---|---|
| LedId | The led id. | 
LedIds
Gets a collection of all mapped ledids.
Declaration
public ICollection<LedId> LedIds { get; }Property Value
| Type | Description | 
|---|---|
| ICollection<LedId> | 
Mappings
Gets a collection of all mapped custom identifiers.
Declaration
public ICollection<T> Mappings { get; }Property Value
| Type | Description | 
|---|---|
| ICollection<T> | 
Methods
| Edit this page View SourceAdd(LedId, T)
Adds a new entry to the mapping.
Declaration
public void Add(LedId ledId, T mapping)Parameters
| Type | Name | Description | 
|---|---|---|
| LedId | ledId | The LedId to map. | 
| T | mapping | The custom identifier to map. | 
Clear()
Removes all registered mappings.
Declaration
public void Clear()Contains(LedId)
Checks if the specified LedId is mapped.
Declaration
public bool Contains(LedId ledId)Parameters
| Type | Name | Description | 
|---|---|---|
| LedId | ledId | The led id to check. | 
Returns
| Type | Description | 
|---|---|
| bool | 
 | 
Contains(T)
Checks if the specified custom identifier is mapped.
Declaration
public bool Contains(T mapping)Parameters
| Type | Name | Description | 
|---|---|---|
| T | mapping | The custom identifier to check. | 
Returns
| Type | Description | 
|---|---|
| bool | 
 | 
GetEnumerator()
Returns an enumerator that iterates through the collection.
Declaration
public IEnumerator<(LedId ledId, T mapping)> GetEnumerator()Returns
| Type | Description | 
|---|---|
| IEnumerator<(LedId ledId, T mapping)> | An enumerator that can be used to iterate through the collection. | 
Remove(LedId)
Removes the specified led id and the mapped custom identifier.
Declaration
public bool Remove(LedId ledId)Parameters
| Type | Name | Description | 
|---|---|---|
| LedId | ledId | The led id to remove. | 
Returns
| Type | Description | 
|---|---|
| bool | 
 | 
Remove(T)
Removes the specified custom identifier and the mapped led id.
Declaration
public bool Remove(T mapping)Parameters
| Type | Name | Description | 
|---|---|---|
| T | mapping | The custom identifier to remove. | 
Returns
| Type | Description | 
|---|---|
| bool | 
 | 
TryGetValue(LedId, out T?)
Gets the custom identifier mapped to the specified led id.
Declaration
public bool TryGetValue(LedId ledId, out T? mapping)Parameters
| Type | Name | Description | 
|---|---|---|
| LedId | ledId | The led id to get the custom identifier for. | 
| T | mapping | Contains the mapped custom identifier or null if there is no mapping for the specified led id. | 
Returns
| Type | Description | 
|---|---|
| bool | 
 | 
TryGetValue(T, out LedId)
Gets the led id mapped to the specified custom identifier.
Declaration
public bool TryGetValue(T mapping, out LedId ledId)Parameters
| Type | Name | Description | 
|---|---|---|
| T | mapping | The custom identifier to get the led id for. | 
| LedId | ledId | Contains the mapped led id or null if there is no mapping for the specified led id. | 
Returns
| Type | Description | 
|---|---|
| bool | 
 |