Given the following:
using
System;
using System.Collections.ObjectModel;
namespace generic_test
{
public class ParentCollection<T> : Collection<T>{
// ......... inherit from generic collection object
}
public class A{
public int someProperty{
get{ return 1; }
}
public A(){
}
}
public class ChildCollection : ParentCollection<A>{
// ......... inherit from ParentCollection but specify type-modifier
}
public class B{
ChildCollection coll = new ChildCollection();
public B(){
coll[0].
}
}
}
---------------------
Given the last, unifinished, code line ( coll[0]. ) as typing, when the [ character is typed, intellisense pops up showing
Sealed T System.Collections.OjectModel.Collection.this[int index]
Continuing to the point of typing the . after the indexer, intellisense doesn't popup at all.
It looks like it's not recognising that the ChildCollection class has the type modifier of A. Since only instances of class A can be added to this collection, the indexer should be reckognised as returning A and intellisense popping up with the someProperty property shown. Instead, intellisense seams to skip the ChildCollection definition and go straight to the Collection<T> class.
It's only intellisense that's not working as I'd expect it, code that assumes instance of A are returned by the indexer compile and work correctly.
Is this an issue with #D's intellisense, or just the way I'm making the class definitions (or am I just expecting behaviour that's not feasible to implement). If there's a way to get what I want and still get intellisense to work, please let me know.
Thanks in advance