All of the following seem to work for me:

   public class FileCollection<T> : List<T>
   {
       public new T this[int index]
       {
           get
           {
               ...
           }
           set
           {
               ...
           }
       }
   }


   public class FileCollection<T> : List<T>
   {
       public T this[object index]
       {
           get
           {
               ...
           }
           set
           {
               ...
           }
       }
   }

   public class FileCollection<T> : List<T>
   {
       public T this[T index]
       {
           get
           {
               ...
           }
           set
           {
               ...
           }
       }
   }

Are you getting some kind of runtime or compiler error?

On 5/23/06, Paul Cowan <[EMAIL PROTECTED]> wrote:

Hi all,

Does anybody have a work round to using Indexers in Generics, I have a
custom class like this:

public class FileCollection<T> : List<T>
{
}

I would like to create my own indexer but cannot using Generics.  Am I
alone in thinking this is a very limited feature to not have Indexers in
Generics or we cannot have Generic Properties.

Am I missing the point with Generics??Thanks

Paul
===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com




--
Eric Means
[EMAIL PROTECTED]
http://www.randomtree.org/eric/

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to