コード例 #1
0
        public static bool IsEqual(this StructWithBlobs b, StructWithByteLists v)
        {
            if (b.lb.Count != v.lb.Count)
            {
                return(false);
            }

            for (var i = 0; i < b.lb.Count; ++i)
            {
                if (!IsEqual(b.lb[i], v.lb[i]))
                {
                    return(false);
                }
            }

            return(IsEqual(b.b, v.b) &&
                   ((b.nb.Array == null) && (v.nb == null) || IsEqual(b.nb, v.nb)));
        }
コード例 #2
0
        void RoundtripTests()
        {
            var containers = new SimpleContainers();

            for (int i = 0; i < 30; i++)
            {
                containers.strings.Add(i.ToString());
                containers.numbers.Add(i, i.ToString());
            }

            RoundtripObject <SimpleContainers>(containers);

            var blobs = new StructWithBlobs();

            blobs.b = new ArraySegment <byte>(blobData, 0, 30);
            blobs.lb.Add(new ArraySegment <byte>(blobData, 0, 30));
            blobs.lb.Add(new ArraySegment <byte>(blobData, 1, 30));

            RoundtripObject <StructWithBlobs>(blobs);
        }