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

WriteDerivedTypes() private method

private WriteDerivedTypes ( StructMapping mapping, string n, string ns, object o, bool isNullable ) : bool
mapping StructMapping
n string
ns string
o object
isNullable bool
return bool
        bool WriteDerivedTypes(StructMapping mapping, string n, string ns, object o, bool isNullable)
        {
            Type t = o.GetType();
            for (StructMapping derived = mapping.DerivedMappings; derived != null; derived = derived.NextDerivedMapping)
            {
                if (t == derived.TypeDesc.Type)
                {
                    WriteStructMethod(derived, n, ns, o, isNullable, needType: true);
                    return true;
                }

                if (WriteDerivedTypes(derived, n, ns, o, isNullable))
                {
                    return true;
                }
            }

            return false;
        }