2 using System
.Linq
.Expressions
;
3 using System
.Collections
.Generic
;
11 Values
= new List
<int> ();
14 public string Name { get; set; }
18 return parent
?? new Node ();
25 public List
<int> Values { get; set; }
27 public static int Main ()
29 Expression
<Func
<Node
>> e
= () => new Node () { Parent = { Name = "Parent" }
};
30 var mie
= (MemberInitExpression
) e
.Body
;
31 if (mie
.Bindings
[0].BindingType
!= MemberBindingType
.MemberBinding
)
36 e
= () => new Node () { Values = { 1, 2, 3 }
};
37 mie
= (MemberInitExpression
) e
.Body
;
38 if (mie
.Bindings
[0].BindingType
!= MemberBindingType
.ListBinding
)
43 e
= () => new Node () { Parent = null }
;
44 mie
= (MemberInitExpression
) e
.Body
;
45 if (mie
.Bindings
[0].BindingType
!= MemberBindingType
.Assignment
)
50 e
= () => new Node () { Values = { }
};
51 mie
= (MemberInitExpression
) e
.Body
;
52 if (mie
.Bindings
[0].BindingType
!= MemberBindingType
.MemberBinding
)
57 e
= () => new Node() { Parent = { Name = "Parent" }
, Values
= { 4, 5, 7, 8 }
};
58 mie
= (MemberInitExpression
) e
.Body
;
59 if (mie
.Bindings
[0].BindingType
!= MemberBindingType
.MemberBinding
)
62 if (mie
.Bindings
[1].BindingType
!= MemberBindingType
.ListBinding
)
66 Console
.WriteLine ("ok");