|
-
September 19th, 2008, 04:23 AM
#1
Type parameter question
Hi,
I've defined a generic class where I tried to access a static method in
'T', but I got the error message: "'T' is a 'type parameter', which is not valid in the given context"
Code:
public class MyGenericClass<T>
where T : new()
{
public void MyMethod()
{
string s = T.GetString(); // GetString() is a static method
^
error here
}
}
Is there something missing in the constraints or isn't it possible to access static methods in the type parameter ?
PS: I'm using MVS 2005
Last edited by NetMaster; September 19th, 2008 at 05:05 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|