skip to main
|
skip to sidebar
C# Quest for Perfection
Sunday, September 24, 2006
Defining a generic method in a non-generic class
For instance:
class
Class2
{
public static void
GenericMethod
<X>(
int
n)
where
X:new()
{
X myXinstance =
new
X();
}
}
The method can be called like this:
Class2.GenericMethod <System.Collections.ArrayList>
(100);
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
About Me
Ovidiu G. Lazar
View my complete profile
Blog Archive
►
2007
(2)
►
August
(1)
►
February
(1)
▼
2006
(14)
►
December
(1)
►
November
(1)
►
October
(1)
▼
September
(7)
Reading and writing data (securely) in a C# 2.0 Wi...
Call one constructor from another
Defining a generic method in a non-generic class
Getting the identity of an assembly
Using the new delegate Syste.Predicate
Undocumented C# keywords
Debugging Windows Services In Visual Studio 2005
►
August
(4)
No comments:
Post a Comment