Beispiel #1
0
        public static Cursor ToCursor(this IEditable source, bool freeze = true)
        {
            if (!source.Frozen)
            {
                if (freeze)
                {
                    source.Freeze();
                }
                else
                {
                    source = source.CloneAsEditable(true);
                }
            }

            return(new Cursor(source.SchemaProvider, source.Schema, new ArraySegment <byte>(source.ToByteArray())));
        }
Beispiel #2
0
        public static byte[] ToByteArray(this IEditable source, bool freeze = true)
        {
            if (!source.Frozen)
            {
                if (freeze)
                {
                    source.Freeze();
                }
                else
                {
                    source = source.CloneAsEditable(true);
                }
            }

            var buffer = new byte[source.SerializedSize];

            source.WriteTo(new MemoryStream(buffer));
            return(buffer);
        }