Reputation: 3218
I need a type that keeps track of a collection and the selected value in a collection, similar to what a list box would do. Is there an existing (non-gui control) collection for this? I know it's fairly simple but I would rather use Microsoft's provided type if there is one.
Basically, this is what I want:
interface ISelectionList<T>
{
T Selected
{
get;
set;
}
IList<T> Values
{
}
}
Upvotes: 0
Views: 76
Reputation: 351526
No, there is nothing like that in the .NET framework.
I would like to suggest that you build your interface a bit differently to leverage the power of inherited interfaces.
Try something like this:
interface ISelectionList<T> : IList<T>
{
T Selected { get; set; }
}
This will allow you to still use your ISelectionList<T>
as an IList<T>
where needed.
Upvotes: 5