'How can i only add to a list if it doesnt exist using lambda expression in c#?
I am using
myObject.UserObject.Any = (myObject.UserObject.Any ?? Enumerable.Empty<XmlElement>())
.Concat(new[] { GetNewXmlElement(addressObject.Street, columnsObject.First(t => t.Key
== columnsObject.Name).Value, false, columnsObject.Name) }).ToArray();
what this does is just add the value to the end of myObject even if there is one exactly the same in the list , ie it gives duplicates.
How can i only add if there isnt one already in the list by checking Street Value in the Name node of the xml ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
