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
In class/Microsoft.Build.Tasks/Microsoft.Build.Tasks:
[mcs.git]
/
tests
/
gtest-462.cs
blob
32b9c1596021e16790ee105667901f4d0b18300b
1
using
System
;
2
3
class
Program
4
{
5
static int
Main
()
6
{
7
Tester
<
int
>
t
=
new
Tester
<
int
> ();
8
int
r
=
t
.
Get
(
333
);
9
Console
.
WriteLine
(
r
);
10
if
(
r
!=
333
)
11
return
1
;
12
13
r
=
t
.
Get
(
222.12
);
14
Console
.
WriteLine
(
r
);
15
if
(
r
!=
0
)
16
return
2
;
17
18
return
0
;
19
}
20
21
class
Tester
<
T
>
where T
:
struct
,
IConvertible
22
{
23
public
T
Get
(
object
data
)
24
{
25
var
val
=
data
;
26
if
(
val
is
T
)
27
return
(
T
)
val
;
28
return default
(
T
);
29
}
30
}
31
}