1- using System ;
1+ #nullable enable
2+ using System ;
23using System . Collections . Generic ;
34using System . Linq . Expressions ;
45using System . Reflection ;
@@ -19,7 +20,7 @@ internal static partial class ExpressionShortcuts
1920 /// <typeparam name="T">Expected type of resulting <see cref="Expression"/></typeparam>
2021 /// <returns><see cref="ExpressionContainer{T}"/></returns>
2122 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
22- public static ExpressionContainer < T > Arg < T > ( Expression expression ) => expression == null ? Null < T > ( ) : new ExpressionContainer < T > ( expression ) ;
23+ public static ExpressionContainer < T > Arg < T > ( Expression ? expression ) => expression == null ? Null < T > ( ) : new ExpressionContainer < T > ( expression ) ;
2324
2425 /// <summary>
2526 /// Creates strongly typed representation of the <see cref="ExpressionContainer.Expression"/>
@@ -39,7 +40,7 @@ internal static partial class ExpressionShortcuts
3940 /// <typeparam name="T">Expected type of resulting <see cref="Expression"/></typeparam>
4041 /// <returns><see cref="ExpressionContainer{T}"/></returns>
4142 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
42- public static ExpressionContainer < T > Arg < T > ( Expression < T > expression ) => expression == null ? Null < T > ( ) : new ExpressionContainer < T > ( expression ) ;
43+ public static ExpressionContainer < T > Arg < T > ( Expression < T > ? expression ) => expression == null ? Null < T > ( ) : new ExpressionContainer < T > ( expression ) ;
4344
4445 /// <summary>
4546 /// Creates strongly typed representation of the <paramref name="expression"/> and performs <see cref="Expression.Convert(System.Linq.Expressions.Expression,System.Type)"/> on it.
@@ -49,7 +50,7 @@ internal static partial class ExpressionShortcuts
4950 /// <typeparam name="T">Expected type of resulting <see cref="Expression"/></typeparam>
5051 /// <returns><see cref="ExpressionContainer{T}"/></returns>
5152 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
52- public static ExpressionContainer < T > Cast < T > ( Expression expression ) => expression == null ? Null < T > ( ) : new ExpressionContainer < T > ( Expression . Convert ( expression , typeof ( T ) ) ) ;
53+ public static ExpressionContainer < T > Cast < T > ( Expression ? expression ) => expression == null ? Null < T > ( ) : new ExpressionContainer < T > ( Expression . Convert ( expression , typeof ( T ) ) ) ;
5354
5455 /// <summary>
5556 /// Creates strongly typed representation of the <see cref="Expression.Variable(System.Type, System.String)"/>
@@ -58,7 +59,7 @@ internal static partial class ExpressionShortcuts
5859 /// <typeparam name="T">Expected type of resulting <see cref="ParameterExpression"/></typeparam>
5960 /// <returns><see cref="ExpressionContainer{T}"/></returns>
6061 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
61- public static ExpressionContainer < T > Var < T > ( string name = null )
62+ public static ExpressionContainer < T > Var < T > ( string ? name = null )
6263 {
6364 return new ExpressionContainer < T > ( Expression . Variable ( typeof ( T ) , name ?? typeof ( T ) . Name ) ) ;
6465 }
@@ -70,7 +71,7 @@ public static ExpressionContainer<T> Var<T>(string name = null)
7071 /// <typeparam name="T">Expected type of resulting <see cref="ParameterExpression"/></typeparam>
7172 /// <returns><see cref="ExpressionContainer{T}"/></returns>
7273 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
73- public static ExpressionContainer < T > Parameter < T > ( string name = null )
74+ public static ExpressionContainer < T > Parameter < T > ( string ? name = null )
7475 {
7576 return new ExpressionContainer < T > ( Expression . Parameter ( typeof ( T ) , name ?? typeof ( T ) . Name ) ) ;
7677 }
@@ -211,14 +212,14 @@ public static ExpressionContainer<T> New<T>(Expression<Func<T>> invocationExpres
211212 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
212213 public static ExpressionContainer < T > New < T > ( ) where T : new ( )
213214 {
214- return Arg < T > ( Expression . New ( typeof ( T ) . GetConstructor ( new Type [ 0 ] ) ) ) ;
215+ return Arg < T > ( Expression . New ( typeof ( T ) . GetConstructor ( Type . EmptyTypes ) ! ) ) ;
215216 }
216217
217218 /// <summary>
218219 /// Provides fluent interface for <see cref="BlockExpression"/> creation
219220 /// </summary>
220221 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
221- public static BlockBuilder Block ( Type returnType = null )
222+ public static BlockBuilder Block ( Type ? returnType = null )
222223 {
223224 return new BlockBuilder ( returnType ) ;
224225 }
@@ -294,7 +295,7 @@ public static SwitchBuilder<T> Switch<T>(ExpressionContainer<T> value)
294295 /// </summary>
295296 /// <returns></returns>
296297 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
297- public static ConditionBuilder Condition ( Type resultType = null )
298+ public static ConditionBuilder Condition ( Type ? resultType = null )
298299 {
299300 return new ConditionBuilder ( resultType ) ;
300301 }
0 commit comments