views:

340

answers:

2

I need simple example to use ISerializable,IEnumerable,IList with Generics efficiently.

Also wish to know what are all the other Interfaces we can use along with Generics.

Update : The task i need to perform is using these interfaces

  1. I have to serialize the custom Types
  2. Collect them in Generic object
  3. Iterate them to find the match
+2  A: 

This question is very broad.

Note that the interfaces you've listed are not all about the same thing.

ISerializable is not generic, and deals with serialization of objects to streams or similar.

IEnumerable is about being able to enumerating over a collection or something that produces a stream of elements.

IList is an interface that is typically implemented by such a collection.

It would help us helping you if you could narrow down your question somewhat. As your question stands now, it's more like "I need to know everything there is to know about cars".

As for "all other interfaces that can be used with generics", have you looked at the MSDN Documentation for the .NET framework classes?

Lasse V. Karlsen
+1  A: 

I have a feeling that this question is a homework question...but I'll bite with a little information.

Generics != Interfaces. Basically you can use any interface that you want with Generics, it is one of the more powerful parts of generics, by using interfaces that you create, you can then define generic methods that process multiple concrete implementations by limiting the generic type to objects that implement a specific interface.

Mitchel Sellers