How can i do something like IList<T>.Contains(OtherObjectType) ?

Posted by Noctris on Stack Overflow See other posts from Stack Overflow or by Noctris
Published on 2010-06-01T11:28:25Z Indexed on 2010/06/01 11:33 UTC
Read the original article Hit count: 132

Filed under:
|
|
|

Hi,

I have the following classes:

Client

ClientCacheMedia ( contains Client, Media and some other parameters so it is the link between the media and the client)

Media

where client contains an IList. Now what i would like to do, is have a way to check if this ilist contains a certain media

so : Client.ClientCacheMedia.Contains(MyMedia)

is there any way to let the IList accept media as an object to match ? ( i can easily override the Equals Property on ClientCacheMedia to check if the media passed is the one that the ClientCacheMedia.Media contains, it's just the Ilist that will not accept any other object on the Contains Method.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET