System.Xml.Serialization.ReflectionXmlSerializationWriter.WriteArray C# (CSharp) Method

WriteArray() private method

private WriteArray ( object o, object choiceSource, ElementAccessor elements, TextAccessor text, ChoiceIdentifierAccessor choice, TypeDesc arrayTypeDesc ) : void
o object
choiceSource object
elements ElementAccessor
text TextAccessor
choice ChoiceIdentifierAccessor
arrayTypeDesc TypeDesc
return void
        private void WriteArray(object o, object choiceSource, ElementAccessor[] elements, TextAccessor text, ChoiceIdentifierAccessor choice, TypeDesc arrayTypeDesc)
        {
            if (elements.Length == 0 && text == null)
            {
                return;
            }

            if (arrayTypeDesc.IsNullable && o == null)
            {
                return;
            }

            if (choice != null)
            {
                if (choiceSource == null || ((Array)choiceSource).Length < ((Array)o).Length)
                {
                    throw CreateInvalidChoiceIdentifierValueException(choice.Mapping.TypeDesc.FullName, choice.MemberName);
                }
            }

            WriteArrayItems(elements, text, choice, arrayTypeDesc, o);
        }