예제 #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())));
        }
예제 #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);
        }