4 // parser conditional and cast expression tests
9 public static int Value
;
12 public class ConditionalParsing
16 public T (string path
, bool mode
)
17 : this (path
, mode
, (mode
== true ? 1 : 2), 1, int.MaxValue
)
21 public T (string s
, bool m
, int i
, int i2
, int i3
)
28 const int c
= true ? 1 : 2;
35 struct MyTestStruct
: IDisposable
37 public void Dispose ()
41 public static implicit operator MyTestStruct (int i
)
43 return new MyTestStruct ();
56 int _provider
= mp
.Length
== a
? _provider
= 4 : 5;
59 T
? Test_3
<T
> (Func
<T
, T
, T
> result
, T t
) where T
: struct
61 return new T
? (result (t
, t
));
64 void Test_4 (bool x
, bool y
)
66 int s
= x
? (y
? 2 : 4) : (y
? 5 : 7);
69 void Test_5 (bool a
, IDisposable fs
)
71 using (a
? fs
: null) {
72 Console
.WriteLine ("");
78 char[] escaped_text_chars
=
80 new char [] {'&', '<', '>', '\r', '\n'}
:
81 new char [] {'&', '<', '>'}
;
84 void Test_7 (object o
)
89 void Test_8 (DateTime
value)
91 var _endDate
= value > DateTime
.MinValue
? new DateTime
? (value) : null;
98 string a
= (b
? (c
? "#" : "#") : "");
103 int i
= new int [] { 1, 2, 3 }
[1];
108 int a
= (int)(A
<int>.Value
);
111 static int Test_12 (bool arg
)
113 return arg
? Foo (() => { return 1; }
) : 1;
116 static int Foo (Func
<int> arg
)
121 void Test_13 (object param
)
123 if (param
as bool? ?? false) {} else {}
128 bool a
= false, b
= false;
131 return a
? (b
? c
as int? : null) : null;
134 Action
<int> Test_15 (Action
<int> arg
)
136 return arg
?? (Helper
<int>);
141 bool? b
= Test (1, arg
:2);
147 using (MyTestStruct
? mts
= (int?) 1)
153 void Test_18 (bool b
, Action a
)
155 var e
= b
? () => { }
: a
;
158 void Test_19 (int[,] table
)
160 var x
= 1 > 0 ? table
[5, 1] : 0;
165 var t
= (Object
)string.Empty
;
170 var t
= (Int32
)sbyte.MaxValue
;
173 static void Helper
<T
> (T arg
)
177 static bool Test (object b
, int arg
)
182 public static void Main ()