Пример #1
0
        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());
        }
Пример #2
0
 public byte[] AsBytes(ValueType type) => type.Name switch
 {
     "int" => BitConverter.GetBytes(this.Boolean ? 1 : 0),
Пример #3
0
 public byte[] AsBytes(ValueType type) => type.Name switch
 {
     "int" => BitConverter.GetBytes(this.Integer),