Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-213.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3492c14059e6ef960cc89e364cf78adff4ab64fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;

class MyTest {
	public static void Main(String[] args) {
		S s1 = new S(11);
		I s2 = s1;                          // Implicit boxing S-->I
		S s3 = (S)s2;                       // Explicit unboxing I-->S
		s3.Print();                         // Should print 11, does not
	}
}

interface I {
	void Print();
}

struct S : I {
	public int i;
	public S(int i) { 
		this.i = i;
	}
	public void Print() {
		Console.WriteLine(i);
	}
}