P
P
ProblemBook.NET
Search…
P
P
ProblemBook.NET
ProblemBook.NET
LANGS
Задачник.NET
ProblemBook.NET
Oop
Strings
Linq
Multithreading
ValueTypes
“StructLayout” (Problem)
“MutableProperty” (Solution)
“Boxing” (Solution)
“MutableProperty” (Problem)
“Boxing” (Problem)
“Enumerator” (Solution)
“Enumerator” (Problem)
“StructLayout” (Solution)
Math
Summary
Introduction
Attribution-NonCommercial-NoDerivatives 4.0 International
Powered By
GitBook
“MutableProperty” (Problem)
What will the following code display?
1
public
struct
Foo
2
{
3
public
int
Value
;
4
public
void
Change
(
int
newValue
)
5
{
6
Value
=
newValue
;
7
}
8
}
9
public
class
Bar
10
{
11
public
Foo
Foo
{
get
;
set
;
}
12
}
13
void
Main
()
14
{
15
var
bar
=
new
Bar
{
Foo
=
new
Foo
()
};
16
bar
.
Foo
.
Change
(
5
);
17
Console
.
WriteLine
(
bar
.
Foo
.
Value
);
18
}
Copied!
Solution
Previous
“Boxing” (Solution)
Next
“Boxing” (Problem)
Last modified
3yr ago
Copy link