Merge pull request #1861 from saper/home-override
[mono-project.git] / mcs / tests / gtest-133.cs
blob35162455e6a9b4f944b732da09eb910746d60752
1 // Not used -- ex-nullable-struct
3 // Converting a struct from S to S? creates a copy of the struct.
4 // Getting the struct out of the non-null value creates another copy.
6 using System;
8 struct S {
9 private int x;
10 public int X {
11 get { return x; }
12 set { this.x = value; } // Cannot be used on non-variable ns.Value
14 public void Set(int x) {
15 this.x = x;
19 class MyTest {
20 public static void Main(String[] args) {
21 S s = new S();
22 s.Set(11);
23 Console.WriteLine("s.X = {0}", s.X);
24 S? ns = s;
25 Console.WriteLine("s.X = {0} ns.Value.X = {1}", s.X, ns.Value.X);
26 ns.Value.Set(22);
27 Console.WriteLine("s.X = {0} ns.Value.X = {1}", s.X, ns.Value.X);
28 s.Set(33);
29 Console.WriteLine("s.X = {0} ns.Value.X = {1}", s.X, ns.Value.X);