using System;
+struct Point {
+ public int x;
+ public int y;
+}
+
class Foo {
static int X = 10;
static int[] Arr = new int[1];
ref int ReturnFunc () {
return ref ReturnStatic ();
}
+
+ Point mp;
+
+ ref int Pick (bool b, ref Point p) {
+ if (b)
+ return ref p.x;
+ else
+ return ref p.y;
+ }
+
+ void F (bool b) {
+ Point lp = new Point {x = 3, y = 3};
+ ref int z = ref Pick (b, ref lp);
+ z = 4;
+ ref int z2 = ref Pick (b, ref mp);
+ z2 = 5;
+ }
}