I have a list in c# as:
List<Data> uData = new List<uData>();
Where uData is populated from UI as:
{
Id: 1,
Name: "Smith",
Input: "7,8",
Output: "Output1",
CreatedBy: "swallac",
CreatedON: "12/01/2018"
},
{
Id: 2,
Name: "Austin",
Input: "7,8",
Output: "Output1",
CreatedBy: "awanda",
CreatedON: "12/03/2018"
},
{
Id: 1,
Name: "Smith",
Input: "22,22",
Output: "Output2",
CreatedBy: "swallac",
CreatedON: "12/01/2018"
},
{
Id: 1,
Name: "Smith",
Input: "9,8",
Output: "Output2",
CreatedBy: "swallac",
CreatedON: "12/01/2018"
},
{
Id: 1,
Name: "Peter",
Input: "1,10",
Output: "Output3",
CreatedBy: "pjon",
CreatedON: "12/02/2018"
}
What I want to do is search this list on "Output" key, and find out if there are in duplicates in the corresponding value of "Input" key.
For example, in my above example list I have three Output: Output1,Output2, Output3. Now for lists with key of Output value as "Output1" the corresponding "Input" key is duplicate here. The value being "7,8". This is what I want to highlight. So Output1 has duplicate Input which Output2 & Output3 have not.
I can do like below to first find out output then check for the value:
var myList = uData.Where(p => p.Output == "Output").First();
But I wont be knowing all the Output in advance to check.
Any inputs to get started on this?