mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-07 16:55:04 +00:00
The `RoutingPortCollection` type appears to not be currently serializable. If a class that contains this collection is going to be serialized, the collection should have the `JsonIgnore` attribute added. If the list is needed, use a conversion object and convert it to a regular list.
40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace PepperDash.Essentials.Core
|
|
{
|
|
/// <summary>
|
|
/// Basically a List , with an indexer to find ports by key name
|
|
/// </summary>
|
|
public class RoutingPortCollection<T> : List<T> where T: RoutingPort
|
|
{
|
|
/// <summary>
|
|
/// Case-insensitive port lookup linked to ports' keys
|
|
/// </summary>
|
|
public T this[string key]
|
|
{
|
|
get
|
|
{
|
|
return this.FirstOrDefault(i => i.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
|
|
}
|
|
}
|
|
}
|
|
|
|
/* /// <summary>
|
|
/// Basically a List , with an indexer to find ports by key name
|
|
/// </summary>
|
|
public class RoutingPortCollection<T, TSelector> : List<T> where T : RoutingPort<TSelector>
|
|
{
|
|
/// <summary>
|
|
/// Case-insensitive port lookup linked to ports' keys
|
|
/// </summary>
|
|
public T this[string key]
|
|
{
|
|
get
|
|
{
|
|
return this.FirstOrDefault(i => i.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
|
|
}
|
|
}
|
|
}*/
|
|
} |