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
2009-03-11 Zoltan Varga <vargaz@gmail.com>
[mcs.git]
/
tests
/
test-65.cs
blob
b117ae309a4ba23af0f8062b23dfc253028ba695
1
//
2
// This exercises the various ways in which the new operator works
3
// with value types.
4
//
5
6
using
System
;
7
8
struct
S
{
9
int
v
;
10
}
11
12
class
X
{
13
static bool
receive
,
create
,
create_and_box
;
14
15
static void
receiver
(
S x
)
16
{
17
receive
=
true
;
18
}
19
20
static object
BoxS
()
21
{
22
create_and_box
=
true
;
23
return new
S
();
24
}
25
26
static
S
Plain
()
27
{
28
create
=
true
;
29
return new
S
();
30
}
31
32
static int
Main
()
33
{
34
object
a
=
new
S
();
35
receiver
(
new
S
());
36
S s
=
Plain
();
37
object
o
=
BoxS
();
38
39
if
(
a
==
null
)
40
return
1
;
41
if
(
receive
==
false
)
42
return
2
;
43
if
(
create
==
false
)
44
return
3
;
45
if
(
create_and_box
==
false
)
46
return
4
;
47
48
Console
.
WriteLine
(
"Test pass"
);
49
return
0
;
50
}
51
}