Last active
November 23, 2016 16:15
-
-
Save ciniml/552af709c91628de520a9d7faacd3db4 to your computer and use it in GitHub Desktop.
Deconstructable ConvertExpressionParts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private struct ConvertExpressionParts | |
{ | |
public Expression[] Prologue { get; } | |
public Expression[] ValueExpressions { get; } | |
public int Size { get; } | |
public ParameterExpression[] Variables { get; } | |
public ConvertExpressionParts(Expression[] prologue, Expression[] valueExpressions, int size, ParameterExpression[] variables) | |
{ | |
this.Prologue = prologue; | |
this.ValueExpressions = valueExpressions; | |
this.Size = size; | |
this.Variables = variables; | |
} | |
public void Deconstruct(out Expression[] prologue, out Expression[] valueExpressions, out int size, out ParameterExpression[] variables) | |
{ | |
prologue = this.Prologue; | |
valueExpressions = this.ValueExpressions; | |
size = this.Size; | |
variables = this.Variables; | |
} | |
} | |
private static ConvertExpressionParts MakeConvertExpression_Int8(Expression value, bool isLittleEndian) | |
{ | |
var valueExpressions = new[] | |
{ | |
Expression.Convert(value, typeof(Byte)) | |
}; | |
return new ConvertExpressionParts(null, valueExpressions, 1, null); | |
} | |
(var prologue, var valueExpressions, var size, var variables) = MakeConvertExpression_Int8(value, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment