Ejemplo n.º 1
0
        // Writes a null member into the stream
        private bool CheckForNull(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo, object data)
        {
            bool isNull = data == null;

            // Optimization, Null members are only written for Binary
            if ((isNull) && (((_formatterEnums._serializerTypeEnum == InternalSerializerTypeE.Binary)) ||
                             memberNameInfo._isArrayItem ||
                             memberNameInfo._transmitTypeOnObject ||
                             memberNameInfo._transmitTypeOnMember ||
                             objectInfo._isSi ||
                             (CheckTypeFormat(_formatterEnums._typeFormat, FormatterTypeStyle.TypesAlways))))
            {
                if (typeNameInfo._isArrayItem)
                {
                    if (typeNameInfo._arrayEnum == InternalArrayTypeE.Single)
                    {
                        _serWriter.WriteDelayedNullItem();
                    }
                    else
                    {
                        _serWriter.WriteNullItem(memberNameInfo, typeNameInfo);
                    }
                }
                else
                {
                    _serWriter.WriteNullMember(memberNameInfo, typeNameInfo);
                }
            }

            return(isNull);
        }