If I understand your problem (doubtful), the method(s) you wish to call are
static. You call them the same way, via "ClassName.methodName", as in
Thing.GetThing(), or SomeThing.GetStaticVariable.
The fact that you have a collection parameterized by T where T:Thing should
not affect the way you call static methods. You are not invoking these
methods against members of the collection, but using the class name (you are
not using a variable of type T or of type Thing as the invoking object).
On the other hand, if you have the problem of two different static methods,
one in class Thing, and one in class Something, and you want to call one or
the other depending on the type of an individual in the collection, there
are a variety of ways to do that. You could have a virtual (i.e. non
static) method in the class, and in the subclass, that calls the correct
static method depending on the class it is implemented in. Then the correct
function would be invoked in code like:
foreach (T t in collection)
t.invokeCorrectStaticMethodViaVirtualFunction()
You could also test explicitly the type of the object, and invoke the static
method (via the class name) depending on the outcome.
I suspect I don't really understand your problem; perhaps you could clarify
it.
"Bob" <bm*****@swiftkenya.com(nospamm)> wrote in message
news:35**********************************@microsof t.com...
I have an abstract class Thing which has a static method Thing GetThing().
Class Something inherits from Thing. SomeThing supplies static info for
GetThing to get stuff from the database to create a Something.
Now I have a collection Things<T>:List<T> where T:Thing. In that
collection's code how can I call Thing's static method?
T.GetThing gives a compile error.
tempThing = new T();
T.GetThing()
won't work 'cos the method is static not instance.
Any ideas?
--
Bob