repo.or.cz
/
mcs.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
* ResolvedReference.cs (.ctor): Set 'OriginalItemSpec' and 'ResolvedFrom',
[mcs.git]
/
tests
/
gtest-052.cs
blob
f2a8441ba6f6fce27ae77d0b4dd6f541eef3beae
1
// We create an instance of a type parameter which has the new() constraint.
2
using
System
;
3
4
public class
Foo
<
T
>
5
where T
:
new
()
6
{
7
public
T
Create
()
8
{
9
return new
T
();
10
}
11
}
12
13
class
X
14
{
15
public
X
()
16
{ }
17
18
void
Hello
()
19
{
20
Console
.
WriteLine
(
"Hello World"
);
21
}
22
23
static void
Main
()
24
{
25
Foo
<
X
>
foo
=
new
Foo
<
X
> ();
26
foo
.
Create
().
Hello
();
27
}
28
}