Example #1
0
        protected override void WriteElements(IWriteContext context, object obj, ArrayInfo
                                              info)
        {
            IEnumerator objects = AllElements(Container(context), obj);

            if (HasNullBitmap(info))
            {
                BitMap4         nullBitMap       = new BitMap4(info.ElementCount());
                IReservedBuffer nullBitMapBuffer = context.Reserve(nullBitMap.MarshalledLength());
                int             currentElement   = 0;
                while (objects.MoveNext())
                {
                    object current = objects.Current;
                    if (current == null)
                    {
                        nullBitMap.SetTrue(currentElement);
                    }
                    else
                    {
                        context.WriteObject(DelegateTypeHandler(), current);
                    }
                    currentElement++;
                }
                nullBitMapBuffer.WriteBytes(nullBitMap.Bytes());
            }
            else
            {
                while (objects.MoveNext())
                {
                    context.WriteObject(DelegateTypeHandler(), objects.Current);
                }
            }
        }
 protected override void WriteElements(IWriteContext context, object obj, ArrayInfo
     info)
 {
     var objects = AllElements(Container(context), obj);
     if (HasNullBitmap(info))
     {
         var nullBitMap = new BitMap4(info.ElementCount());
         var nullBitMapBuffer = context.Reserve(nullBitMap.MarshalledLength());
         var currentElement = 0;
         while (objects.MoveNext())
         {
             var current = objects.Current;
             if (current == null)
             {
                 nullBitMap.SetTrue(currentElement);
             }
             else
             {
                 context.WriteObject(DelegateTypeHandler(), current);
             }
             currentElement++;
         }
         nullBitMapBuffer.WriteBytes(nullBitMap.Bytes());
     }
     else
     {
         while (objects.MoveNext())
         {
             context.WriteObject(DelegateTypeHandler(), objects.Current);
         }
     }
 }