Class ExpressionSlimTupletizer
Provides a set of methods to pack and unpack expressions into/from tuples.
Inheritance
Namespace: System.Linq.CompilerServices.Bonsai
Assembly: Nuqleon.Linq.Expressions.Bonsai.dll
Syntax
public static class ExpressionSlimTupletizer : Object
Methods
IsTuple(TypeSlim)
Checks whether the specified type is a packed tuple.
Declaration
public static bool IsTuple(TypeSlim type)
Parameters
Type | Name | Description |
---|---|---|
TypeSlim | type | Type to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified type is a tuple; otherwise, false. |
Pack(IEnumerable<ExpressionSlim>)
Packs the specified expressions into an expression that creates a tuple of the expressions.
Declaration
public static ExpressionSlim Pack(IEnumerable<ExpressionSlim> expressions)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ExpressionSlim> | expressions | Expressions to pack in a tuple. |
Returns
Type | Description |
---|---|
ExpressionSlim | Expression representing the creation of a tuple of the given expressions. |
Pack(ExpressionSlim, IEnumerable<ParameterExpressionSlim>)
Creates a lambda expression whose parameters are packed in a tuple. If no parameters are specified, a lambda with no parameters is returned. If exactly one parameter is specified, the parameter will get packed in a 1-tuple.
Declaration
public static LambdaExpressionSlim Pack(ExpressionSlim body, IEnumerable<ParameterExpressionSlim> parameters)
Parameters
Type | Name | Description |
---|---|---|
ExpressionSlim | body | Body of the lambda expression. Occurrences of the specified parameters will get packed in tuples. |
System.Collections.Generic.IEnumerable<ParameterExpressionSlim> | parameters | Parameters to be packed into a single lambda parameter. |
Returns
Type | Description |
---|---|
LambdaExpressionSlim | Lambda expression with parameters packed as a tuple. |
Pack(ExpressionSlim, IEnumerable<ParameterExpressionSlim>, TypeSlim)
Creates a lambda expression whose parameters are packed in a tuple. If no parameters are specified, a lambda with a dummy parameter of the specified 'void' type will be returned. If exactly one parameter is specified, the parameter will get packed in a 1-tuple.
Declaration
public static LambdaExpressionSlim Pack(ExpressionSlim body, IEnumerable<ParameterExpressionSlim> parameters, TypeSlim voidType)
Parameters
Type | Name | Description |
---|---|---|
ExpressionSlim | body | Body of the lambda expression. Occurrences of the specified parameters will get packed in tuples. |
System.Collections.Generic.IEnumerable<ParameterExpressionSlim> | parameters | Parameters to be packed into a single lambda parameter. |
TypeSlim | voidType | Type used to represent an empty parameter list as a single 'void' parameter. |
Returns
Type | Description |
---|---|
LambdaExpressionSlim | Lambda expression with parameters packed as a tuple. |
Pack(LambdaExpressionSlim)
Packs the lambda expression parameters into a tuple. If the lambda expression has no parameters, this method is a no-op. If the lambda expression has exactly one parameter, the parameter will get packed in a 1-tuple.
Declaration
public static LambdaExpressionSlim Pack(LambdaExpressionSlim expression)
Parameters
Type | Name | Description |
---|---|---|
LambdaExpressionSlim | expression | Expression to pack parameters for. |
Returns
Type | Description |
---|---|
LambdaExpressionSlim | Lambda expression with parameters packed as a tuple. |
Pack(LambdaExpressionSlim, TypeSlim)
Packs the lambda expression parameters into a tuple. If the lambda expression has no parameters, a dummy parameter of the specified 'void' type will be inserted. If the lambda expression has exactly one parameter, the parameter will get packed in a 1-tuple.
Declaration
public static LambdaExpressionSlim Pack(LambdaExpressionSlim expression, TypeSlim voidType)
Parameters
Type | Name | Description |
---|---|---|
LambdaExpressionSlim | expression | Expression to pack parameters for. |
TypeSlim | voidType | Type used to represent an empty parameter list as a single 'void' parameter. |
Returns
Type | Description |
---|---|
LambdaExpressionSlim | Lambda expression with parameters packed as a tuple. |
Unpack(ExpressionSlim)
Unpacks the specified expression representing a tuple into the expressions of its components.
Declaration
public static IEnumerable<ExpressionSlim> Unpack(ExpressionSlim expression)
Parameters
Type | Name | Description |
---|---|---|
ExpressionSlim | expression | Expression to unpack into its component expressions. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ExpressionSlim> | Expressions representing the components of the tuple represented by the given expression. |
Unpack(LambdaExpressionSlim)
Unpacks the lambda expression with a tuple-based parameter into a lambda expression with parameters for the tuple components. If the lambda expression has no parameters, this method is a no-op.
Declaration
public static LambdaExpressionSlim Unpack(LambdaExpressionSlim expression)
Parameters
Type | Name | Description |
---|---|---|
LambdaExpressionSlim | expression | Expression to unpack the tuple-based parameter into parameters for its components. |
Returns
Type | Description |
---|---|
LambdaExpressionSlim | Lambda expression with parameters unpacked from the tuple-based parameter. |
Unpack(LambdaExpressionSlim, out ExpressionSlim, out IEnumerable<ParameterExpressionSlim>)
Unpacks the lambda expression with a tuple-based parameter into a lambda body and its set of parameters.
Declaration
public static void Unpack(LambdaExpressionSlim expression, out ExpressionSlim body, out IEnumerable<ParameterExpressionSlim> parameters)
Parameters
Type | Name | Description |
---|---|---|
LambdaExpressionSlim | expression | Expression to unpack the tuple-based parameter into parameters for its components. |
ExpressionSlim | body | Lambda body with parameters unpacked from the tuple-based parameter. |
System.Collections.Generic.IEnumerable<ParameterExpressionSlim> | parameters | The set of parameters that occur in the lambda body. |
Unpack(LambdaExpressionSlim, TypeSlim)
Unpacks the lambda expression with a tuple-based parameter into a lambda expression with parameters for the tuple components. If the lambda expression has no parameters, this method is a no-op. If the lambda expression has one parameter of the specified 'void' type, it will get unpacked into a lambda expression with no parameters.
Declaration
public static LambdaExpressionSlim Unpack(LambdaExpressionSlim expression, TypeSlim voidType)
Parameters
Type | Name | Description |
---|---|---|
LambdaExpressionSlim | expression | Expression to unpack the tuple-based parameter into parameters for its components. |
TypeSlim | voidType | Type used to represent an empty parameter list as a single 'void' parameter. |
Returns
Type | Description |
---|---|
LambdaExpressionSlim | Lambda expression with parameters unpacked from the tuple-based parameter. |
Unpack(LambdaExpressionSlim, TypeSlim, out ExpressionSlim, out IEnumerable<ParameterExpressionSlim>)
Unpacks the lambda expression with a tuple-based parameter into a lambda body and its set of parameters.
Declaration
public static void Unpack(LambdaExpressionSlim expression, TypeSlim voidType, out ExpressionSlim body, out IEnumerable<ParameterExpressionSlim> parameters)
Parameters
Type | Name | Description |
---|---|---|
LambdaExpressionSlim | expression | Expression to unpack the tuple-based parameter into parameters for its components. |
TypeSlim | voidType | Type used to represent an empty parameter list as a single 'void' parameter. |
ExpressionSlim | body | Lambda body with parameters unpacked from the tuple-based parameter. |
System.Collections.Generic.IEnumerable<ParameterExpressionSlim> | parameters | The set of parameters that occur in the lambda body. |