1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
struct Foo { string s; public Foo (string s) { this.s = s; } } class Bar { public Foo? foo { get; set; } } void main () { var bar = new Bar (); var foo = Foo ("hello"); bar.foo = foo; assert (bar.foo.s == "hello"); }