repo.or.cz
/
mono-project.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
2010-05-13 Rodrigo Kumpera <rkumpera@novell.com>
[mono-project.git]
/
mcs
/
tests
/
gtest-132.cs
blob
c87da9d304a317d66173c6db442bc0a9c694ef64
1
//-- ex-nullable-sqrt
2
3
using
System
;
4
5
class
MyTest
{
6
public static int
?
Sqrt
(
int
?
x
) {
7
if
(
x
.
HasValue
&&
x
.
Value
>=
0
)
8
return
(
int
)(
Math
.
Sqrt
(
x
.
Value
));
9
else
10
return null
;
11
}
12
13
public static void
Main
(
String
[]
args
) {
14
// Prints :2:::
15
Console
.
WriteLine
(
":
{0}
:
{1}
:
{2}
:"
,
Sqrt
(
5
),
Sqrt
(
null
),
Sqrt
(-
5
));
16
}
17
}