Hello
I have a list of items. Item is a object with two fields. One field is of type Dictionary<string, List<string>
and second filed is of type int.
Now I want to check if there is an item with both fields unique in that list.
With dict field I care about key part, not value so value part may be the same between items.
It is key that must be unique in that list.
If such element exists I want to be able to get position of that element in my list.
Hope it is clear.
To clarify -
Here is my class
namespace Polstyr
{
class RecordItem
{
Dictionary<string, List<string>> dict;
public string MachineNr { get; set; }
public RecordItem()
{
dict = new Dictionary<string, List<string>>();
}
public void AddToDict(string value, List<string> list)
{
dict.Add(value, list);
}
public Dictionary<string, List<string>> GetDictionary
{
get
{
return dict;
}
}
}
}
In other part of my code I have list of type List<RecordItem>
named recordItems.
I would like to check there is RecordItem object in recordItems list that is unique in that list based on it's fields. Key in dict must be unique and MachineNr must be unique.
Thanks in advance.