"Jon" <Jo*@discussions.microsoft.coma écrit dans le message de news:
C1**********************************@microsoft.com...
| I have a collection class that holds a number of clauses. One particular
| type of clause has a member variable called type - this is an enum.
|
| How do I check this collection class to see if it has a clause of a
| particular type?
|
| I know I'll have to implement a contains (or similar) method, but I'm
after
| code examples.
If you are using .NET 2.0 generic collections :
bool NameMatch(MyType value)
{
return value.Name == "Joanna";
}
void Test()
{
List<MyTypeitems = new List<MyType>();
// add items to list
MyType found = items.Find(NameMatch);
...
}
Joanna
--
Joanna Carter [TeamB]
Consultant Software Engineer