public static byte[] ToByteArray(ValueType type, ValueListInitializerNode exprs) { List <byte> content = new List <byte>(); foreach (IExpr expr in exprs) { if (expr is ILiteral lit) { content.AddRange(lit.AsBytes(type)); } } return(content.ToArray()); }
public byte[] AsBytes(ValueType type) => type.Name switch { "int" => BitConverter.GetBytes(this.Boolean ? 1 : 0),
public byte[] AsBytes(ValueType type) => type.Name switch { "int" => BitConverter.GetBytes(this.Integer),