I have a struct like this
public struct MyStruct
{
public string Name;
//More fields and construtors
}
Now if I have List<MyStruct>
is there a way to use the Contains()
feature of list?
This does not compile:
if(_myStructList.Contains(x => x.Name == "DAMN!")){//DO STUFF}
Here is the error:
Cannot convert lambda expression to type 'MyStruct' because it is not a delegate type
I guess then this is not gonna work with structs?!