1016 references to Write
System.Private.Xml (1016)
System\Xml\Serialization\Compilation.cs (6)
355writer.Write("[assembly:"); 356writer.Write(typeof(XmlSerializerVersionAttribute).FullName); 357writer.Write("("); 358writer.Write("ParentAssemblyId="); 360writer.Write(", Version="); 364writer.Write(", Namespace=");
System\Xml\Serialization\XmlSerializationGeneratedCode.cs (83)
103_writer.Write(typeof(Hashtable).FullName); 104_writer.Write(" "); 105_writer.Write(privateName); 107_writer.Write("public override "); 108_writer.Write(typeof(Hashtable).FullName); 110_writer.Write(" "); 111_writer.Write(publicName); 118_writer.Write("if ("); 119_writer.Write(privateName); 123_writer.Write(typeof(Hashtable).FullName); 124_writer.Write(" _tmp = new "); 125_writer.Write(typeof(Hashtable).FullName); 131_writer.Write("if ("); 132_writer.Write(privateName); 133_writer.Write(" == null) "); 134_writer.Write(privateName); 139_writer.Write("return "); 140_writer.Write(privateName); 157_writer.Write("_tmp["); 159_writer.Write("] = "); 169_writer.Write("public override "); 170_writer.Write(typeof(bool).FullName); 171_writer.Write(" CanSerialize("); 172_writer.Write(typeof(Type).FullName); 191_writer.Write("if (type == typeof("); 192_writer.Write(CodeIdentifier.GetCSharpName(type)); 206_writer.Write("public abstract class "); 207_writer.Write(CodeIdentifier.GetCSharpName(baseSerializer)); 208_writer.Write(" : "); 209_writer.Write(typeof(System.Xml.Serialization.XmlSerializer).FullName); 213_writer.Write("protected override "); 214_writer.Write(typeof(System.Xml.Serialization.XmlSerializationReader).FullName); 217_writer.Write("return new "); 218_writer.Write(readerClass); 223_writer.Write("protected override "); 224_writer.Write(typeof(System.Xml.Serialization.XmlSerializationWriter).FullName); 227_writer.Write("return new "); 228_writer.Write(writerClass); 245_writer.Write("public sealed class "); 246_writer.Write(CodeIdentifier.GetCSharpName(serializerName)); 247_writer.Write(" : "); 248_writer.Write(baseSerializer); 253_writer.Write("public override "); 254_writer.Write(typeof(bool).FullName); 255_writer.Write(" CanDeserialize("); 256_writer.Write(typeof(XmlReader).FullName); 266_writer.Write("return xmlReader.IsStartElement("); 268_writer.Write(", "); 278_writer.Write("protected override void Serialize(object objectToSerialize, "); 279_writer.Write(typeof(System.Xml.Serialization.XmlSerializationWriter).FullName); 282_writer.Write("(("); 283_writer.Write(writerClass); 284_writer.Write(")writer)."); 285_writer.Write(writeMethod); 286_writer.Write("("); 289_writer.Write("(object[])"); 298_writer.Write("protected override object Deserialize("); 299_writer.Write(typeof(System.Xml.Serialization.XmlSerializationReader).FullName); 302_writer.Write("return (("); 303_writer.Write(readerClass); 304_writer.Write(")reader)."); 305_writer.Write(readMethod); 323_writer.Write("_tmp.Add("); 325_writer.Write(", new "); 326_writer.Write((string?)serializers[key]); 335_writer.Write("public override "); 336_writer.Write(typeof(System.Xml.Serialization.XmlSerializer).FullName); 337_writer.Write(" GetSerializer("); 338_writer.Write(typeof(Type).FullName); 355_writer.Write("if (type == typeof("); 356_writer.Write(CodeIdentifier.GetCSharpName(type)); 357_writer.Write(")) return new "); 358_writer.Write((string?)serializers[xmlMappings[i].Key!]); 370_writer.Write("public class XmlSerializerContract : global::"); 371_writer.Write(typeof(System.Xml.Serialization.XmlSerializerImplementation).FullName); 375_writer.Write("public override global::"); 376_writer.Write(typeof(System.Xml.Serialization.XmlSerializationReader).FullName); 377_writer.Write(" Reader { get { return new "); 378_writer.Write(readerType); 381_writer.Write("public override global::"); 382_writer.Write(typeof(System.Xml.Serialization.XmlSerializationWriter).FullName); 383_writer.Write(" Writer { get { return new "); 384_writer.Write(writerType);
System\Xml\Serialization\XmlSerializationReader.cs (447)
2233Writer.Write(Access); 2234Writer.Write(" class "); 2235Writer.Write(ClassName); 2236Writer.Write(" : "); 2237Writer.Write(typeof(System.Xml.Serialization.XmlSerializationReader).FullName); 2303Writer.Write("string "); 2304Writer.Write(idName); 2315Writer.Write(idName); 2316Writer.Write(" = Reader.NameTable.Add("); 2343Writer.Write("if (Reader.IsStartElement("); 2345Writer.Write(", "); 2358Writer.Write(func); 2359Writer.Write("("); 2360Writer.Write(node); 2363Writer.Write(", "); 2402Writer.Write("AddReadCallback("); 2404Writer.Write(", "); 2406Writer.Write(", "); 2407Writer.Write(RaCodeGen.GetStringForTypeof(mapping.TypeDesc.CSharpName, mapping.TypeDesc.UseReflection)); 2408Writer.Write(", new "); 2409Writer.Write(typeof(XmlSerializationReadCallback).FullName); 2410Writer.Write("(this."); 2411Writer.Write(methodName); 2423Writer.Write("object "); 2424Writer.Write(dummyArrayMethodName); 2480Writer.Write("public object[] "); 2481Writer.Write(methodName); 2486Writer.Write("object[] p = new object["); 2487Writer.Write(mappings.Length.ToString(CultureInfo.InvariantCulture)); 2633Writer.Write(arrayName); 2634Writer.Write("["); 2635Writer.Write(i.ToString(CultureInfo.InvariantCulture)); 2636Writer.Write("] = "); 2640Writer.Write("null"); 2644Writer.Write(RaCodeGen.GetStringForCreateInstance(mappings[i].TypeDesc!.CSharpName, mappings[i].TypeDesc!.UseReflection, false, false)); 2659Writer.Write("public object[] "); 2660Writer.Write(methodName); 2666Writer.Write("object[] p = new object["); 2667Writer.Write(mappings.Length.ToString(CultureInfo.InvariantCulture)); 2677Writer.Write("if (!"); 2760Writer.Write(item); 2761Writer.Write(" "); 2762Writer.Write("ci ="); 2763Writer.Write($"({item})"); 2764Writer.Write(source); 2769Writer.Write(RaCodeGen.GetStringForMethod("c", td.CSharpName, "Add", useReflection)); 2774Writer.Write("ci[i]"); 2776Writer.Write($"{RaCodeGen.GetReflectionVariable(typeof(Array).FullName!, "0")}[ci , i]"); 2791Writer.Write("public object "); 2792Writer.Write(methodName); 2830Writer.Write("("); 2831Writer.Write(mapping.TypeDesc!.CSharpName); 2832Writer.Write(")"); 2834Writer.Write(enumMethodName); 2835Writer.Write("("); 2836if (!mapping.IsSoap) Writer.Write(source); 2837Writer.Write(")"); 2841Writer.Write(source); 2847Writer.Write("CollapseWhitespace("); 2848Writer.Write(source); 2849Writer.Write(")"); 2853Writer.Write(source); 2860Writer.Write(typeof(XmlConvert).FullName); 2861Writer.Write("."); 2863Writer.Write("To"); 2864Writer.Write(mapping.TypeDesc.FormatterName); 2865Writer.Write("("); 2866Writer.Write(source); 2867Writer.Write(")"); 2903Writer.Write(typeof(Hashtable).FullName); 2904Writer.Write(" "); 2905Writer.Write(memberName); 2909Writer.Write("internal "); 2910Writer.Write(typeof(Hashtable).FullName); 2911Writer.Write(" "); 2912Writer.Write(propName); 2919Writer.Write("if ((object)"); 2920Writer.Write(memberName); 2924Writer.Write(typeof(Hashtable).FullName); 2925Writer.Write(" h = new "); 2926Writer.Write(typeof(Hashtable).FullName); 2933Writer.Write("h.Add("); 2937Writer.Write(", (long)"); 2938Writer.Write(mapping.TypeDesc.CSharpName); 2939Writer.Write(".@"); 2941Writer.Write(constants[i].Name); 2945Writer.Write(", "); 2946Writer.Write(string.Create(CultureInfo.InvariantCulture, $"{constants[i].Value}L")); 2952Writer.Write(memberName); 2958Writer.Write("return "); 2959Writer.Write(memberName); 2984Writer.Write("object"); 2985Writer.Write(" "); 2986Writer.Write(methodName); 2993Writer.Write(useReflection ? "object" : fullTypeName); 2994Writer.Write(" "); 2995Writer.Write(methodName); 3005Writer.Write("return "); 3006Writer.Write(typeof(Enum).FullName); 3007Writer.Write(".ToObject("); 3008Writer.Write(RaCodeGen.GetStringForTypeof(fullTypeName, useReflection)); 3009Writer.Write(", ToEnum(s, "); 3010Writer.Write(tableName); 3011Writer.Write(", "); 3017Writer.Write("return ("); 3018Writer.Write(fullTypeName); 3019Writer.Write(")ToEnum(s, "); 3020Writer.Write(tableName); 3021Writer.Write(", "); 3038Writer.Write("case "); 3040Writer.Write(": return "); 3041Writer.Write(RaCodeGen.GetStringForEnumMember(fullTypeName, c.Name, useReflection)); 3047Writer.Write("default: throw CreateUnknownConstantException(s, "); 3048Writer.Write(RaCodeGen.GetStringForTypeof(fullTypeName, useReflection)); 3062Writer.Write("if ("); 3073Writer.Write("return "); 3075Writer.Write($"({returnTypeName})"); 3076Writer.Write(methodName); 3077Writer.Write("("); 3079Writer.Write("isNullable, "); 3099Writer.Write("if ("); 3109Writer.Write("object e = "); 3110Writer.Write(methodName); 3121Writer.Write("if ("); 3135Writer.Write(typeof(Array).FullName); 3137Writer.Write("object"); 3140Writer.Write(fullTypeName); 3141Writer.Write(" a = "); 3144Writer.Write(RaCodeGen.GetStringForCreateInstance(fullTypeName, td.UseReflection, false, false)); 3167Writer.Write(typeName); 3168Writer.Write(" "); 3169Writer.Write(methodName); 3173Writer.Write(typeName); 3174Writer.Write(" o = "); 3178Writer.Write("null"); 3182Writer.Write("default("); 3183Writer.Write(typeName); 3184Writer.Write(")"); 3220Writer.Write(typeName); 3221Writer.Write(" "); 3222Writer.Write(methodName); 3223Writer.Write("("); 3225Writer.Write("bool isNullable, "); 3229Writer.Write(typeof(XmlQualifiedName).FullName); 3242Writer.Write("else return "); 3245Writer.Write(RaCodeGen.GetStringForCreateInstance(structMapping.TypeDesc.CSharpName, useReflection, false, false)); 3254Writer.Write("if (xsiType == null"); 3257Writer.Write(" || "); 3273Writer.Write("return ReadTypedPrimitive(("); 3275Writer.Write("throw CreateUnknownTypeException(("); 3276Writer.Write(typeof(XmlQualifiedName).FullName); 3288Writer.Write("throw CreateAbstractTypeException("); 3290Writer.Write(", "); 3425Writer.Write("object"); 3426Writer.Write(" "); 3427Writer.Write(methodName); 3428Writer.Write("("); 3438Writer.Write("throw CreateAbstractTypeException("); 3440Writer.Write(", "); 3498Writer.Write("void "); 3499Writer.Write(fixupMethodName); 3512Writer.Write("if (ids["); 3513Writer.Write(fixupIndex); 3536Writer.Write(targetSource); 3542Writer.Write(member.CheckSpecifiedSource); 3570Writer.Write("if ((object)("); 3571Writer.Write(memberSource); 3577Writer.Write("throw CreateReadOnlyCollectionException("); 3583Writer.Write(memberSource); 3584Writer.Write(" = "); 3585Writer.Write(RaCodeGen.GetStringForCreateInstance(typeDesc.CSharpName, typeDesc.UseReflection, typeDesc.CannotNew, true)); 3592Writer.Write("CollectionFixup collectionFixup = new CollectionFixup("); 3593Writer.Write(memberSource); 3594Writer.Write(", "); 3595Writer.Write("new "); 3596Writer.Write(typeof(XmlSerializationCollectionFixupCallback).FullName); 3597Writer.Write("(this."); 3598Writer.Write(create.Name); 3599Writer.Write("), "); 3600Writer.Write(targetSource); 3607Writer.Write("void "); 3608Writer.Write(c.Name); 3628Writer.Write("((object) (("); 3629Writer.Write(typeof(XmlQualifiedName).FullName); 3630Writer.Write(")"); 3631Writer.Write(source); 3632Writer.Write(").Name == (object)"); 3634Writer.Write(" && (object) (("); 3635Writer.Write(typeof(XmlQualifiedName).FullName); 3636Writer.Write(")"); 3637Writer.Write(source); 3638Writer.Write(").Namespace == (object)"); 3640Writer.Write(")"); 3645Writer.Write("("); 3648Writer.Write("(object) "); 3649Writer.Write(source); 3650Writer.Write(".LocalName == (object)"); 3652Writer.Write(" && "); 3654Writer.Write("(object) "); 3655Writer.Write(source); 3656Writer.Write(".NamespaceURI == (object)"); 3658Writer.Write(")"); 3670Writer.Write(idName); 3700Writer.Write("else "); 3702Writer.Write("if ("); 3705Writer.Write("!"); 3706Writer.Write(member.ParamsReadSource); 3707Writer.Write(" && "); 3725Writer.Write("else "); 3732Writer.Write("if ("); 3733Writer.Write(xmlnsMember.Source); 3734Writer.Write(" == null) "); 3735Writer.Write(xmlnsMember.Source); 3736Writer.Write(" = new "); 3737Writer.Write(xmlnsMember.Mapping.TypeDesc!.CSharpName); 3741Writer.Write($"(({xmlnsMember.Mapping.TypeDesc.CSharpName}){xmlnsMember.ArraySource})"); 3757Writer.Write(typeof(XmlAttribute).FullName); 3758Writer.Write(" attr = "); 3759Writer.Write("("); 3760Writer.Write(typeof(XmlAttribute).FullName); 3767Writer.Write(elseCall); 3768Writer.Write("("); 3769Writer.Write(firstParam); 3772Writer.Write(", "); 3802Writer.Write("attr"); 3808Writer.Write("if (attr is "); 3809Writer.Write(typeof(XmlAttribute).FullName); 3813Writer.Write("("); 3814Writer.Write(typeof(XmlAttribute).FullName); 3815Writer.Write(")attr"); 3852Writer.Write(member.CheckSpecifiedSource); 3857Writer.Write(member.ParamsReadSource); 3881Writer.Write("Fixup fixup = new Fixup("); 3882Writer.Write(source); 3883Writer.Write(", "); 3884Writer.Write("new "); 3885Writer.Write(typeof(XmlSerializationFixupCallback).FullName); 3886Writer.Write("(this."); 3887Writer.Write(fixupMethodName); 3888Writer.Write("), "); 3889Writer.Write(fixupCount.ToString(CultureInfo.InvariantCulture)); 3915Writer.Write("int "); 3916Writer.Write(c); 3924Writer.Write("int c"); 3925Writer.Write(member.ChoiceArrayName); 3935Writer.Write(member.Source); 3936Writer.Write(a); 3947Writer.Write("if ((object)("); 3948Writer.Write(member.Source); 3949Writer.Write(") == null) "); 3952Writer.Write("throw CreateReadOnlyCollectionException("); 3958Writer.Write(member.Source); 3959Writer.Write(" = "); 3960Writer.Write(RaCodeGen.GetStringForCreateInstance(typeDescFullName, useReflection, typeDesc.CannotNew, true)); 4015Writer.Write("if (Reader.NodeType == "); 4016Writer.Write(typeof(XmlNodeType).FullName); 4045Writer.Write("else if (Reader.NodeType == "); 4046Writer.Write(typeof(XmlNodeType).FullName); 4048Writer.Write("Reader.NodeType == "); 4049Writer.Write(typeof(XmlNodeType).FullName); 4051Writer.Write("Reader.NodeType == "); 4052Writer.Write(typeof(XmlNodeType).FullName); 4054Writer.Write("Reader.NodeType == "); 4055Writer.Write(typeof(XmlNodeType).FullName); 4065Writer.Write(elseString); 4082Writer.Write("Document.CreateTextNode(Reader.ReadString())"); 4096Writer.Write("CollapseWhitespace(Reader.ReadString())"); 4100Writer.Write("Reader.ReadString()"); 4107Writer.Write("tmp = ReadString(tmp, "); 4114Writer.Write("tmp"); 4135Writer.Write(checkTypeHrefsSource); 4137Writer.Write(checkTypeHrefsSource); 4143Writer.Write(checkTypeHrefsSource); 4145Writer.Write(checkTypeHrefsSource); 4225Writer.Write("else "); 4229Writer.Write("case "); 4230Writer.Write(cases.ToString(CultureInfo.InvariantCulture)); 4237Writer.Write("if ("); 4240Writer.Write("!"); 4241Writer.Write(member.ParamsReadSource); 4242Writer.Write(" && "); 4249Writer.Write(RaCodeGen.GetStringForTypeof(td.CSharpName, td.UseReflection)); 4253Writer.Write(RaCodeGen.GetStringForTypeof(e.Mapping!.TypeDesc!.CSharpName, e.Mapping.TypeDesc.UseReflection)); 4255Writer.Write(".IsAssignableFrom("); 4256Writer.Write(checkTypeSource); 4257Writer.Write("Type)"); 4262Writer.Write("(IsReturnValue || "); 4265Writer.Write("true"); 4272Writer.Write(")"); 4280Writer.Write("if ("); 4281Writer.Write(checkTypeSource); 4289Writer.Write(RaCodeGen.GetStringForCreateInstance(e.Mapping.TypeDesc.CSharpName, e.Mapping.TypeDesc.UseReflection, false, true, $"({td.CSharpName}){checkTypeSource}")); 4294Writer.Write(checkTypeSource); 4305Writer.Write("fixup.Ids["); 4306Writer.Write(member.FixupIndex.ToString(CultureInfo.InvariantCulture)); 4307Writer.Write("] = "); 4308Writer.Write(checkTypeSource); 4320Writer.Write(member.ParamsReadSource); 4338Writer.Write("state = "); 4339Writer.Write(cases.ToString(CultureInfo.InvariantCulture)); 4433Writer.Write(" soap[1] = "); 4441Writer.Write($"({arrayTypeFullName}[])"); 4442Writer.Write("ShrinkArray("); 4443Writer.Write(a); 4444Writer.Write(", "); 4445Writer.Write(c); 4446Writer.Write(", "); 4447Writer.Write(RaCodeGen.GetStringForTypeof(arrayTypeFullName, arrayUseReflection)); 4448Writer.Write(", "); 4450Writer.Write(")"); 4463Writer.Write($"({choiceTypeName}[])"); 4464Writer.Write("ShrinkArray("); 4465Writer.Write(a); 4466Writer.Write(", "); 4467Writer.Write(c); 4468Writer.Write(", "); 4469Writer.Write(RaCodeGen.GetStringForTypeof(choiceTypeName, choiceUseReflection)); 4470Writer.Write(", "); 4472Writer.Write(")"); 4479Writer.Write(member.Source); 4480Writer.Write(" = "); 4481Writer.Write(member.ArrayName); 4493Writer.Write("("); 4494Writer.Write(typeDesc.CSharpName); 4495Writer.Write(")"); 4501Writer.Write(source); 4503Writer.Write(" = "); 4511Writer.Write(")"); 4513Writer.Write("})"); 4520Writer.Write("object rre = "); 4521Writer.Write(fixupIndex >= 0 ? "ReadReferencingElement" : "ReadReferencedElement"); 4522Writer.Write("("); 4524Writer.Write(", "); 4528Writer.Write(", "); 4529Writer.Write("out fixup.Ids["); 4530Writer.Write((fixupIndex).ToString(CultureInfo.InvariantCulture)); 4531Writer.Write("]"); 4549Writer.Write("rre"); 4572Writer.Write("if (((object)("); 4573Writer.Write(member.ArrayName); 4574Writer.Write(") == null) || "); 4578Writer.Write("if ("); 4622Writer.Write(checkSpecified); 4638Writer.Write(methodName); 4639Writer.Write("(true)"); 4652Writer.Write(RaCodeGen.GetStringForCreateInstance(element.Mapping.TypeDesc.CSharpName, element.Mapping.TypeDesc.UseReflection, false, false)); 4656Writer.Write("null"); 4662Writer.Write("else "); 4687Writer.Write("default(System.TimeSpan)"); 4691Writer.Write("default(System.DateTimeOffset)"); 4710Writer.Write("ReadElementQualifiedName()"); 4738Writer.Write("object rre = "); 4739Writer.Write(fixupIndex >= 0 ? "ReadReferencingElement" : "ReadReferencedElement"); 4740Writer.Write("("); 4742Writer.Write(", "); 4747Writer.Write(", out fixup.Ids["); 4748Writer.Write((fixupIndex).ToString(CultureInfo.InvariantCulture)); 4749Writer.Write("]"); 4751Writer.Write(")"); 4764Writer.Write("rre"); 4768Writer.Write("Referenced("); 4769Writer.Write(source); 4787Writer.Write("if ((object)("); 4788Writer.Write(arrayName); 4789Writer.Write(") == null) Reader.Skip(); else "); 4792Writer.Write(methodName); 4793Writer.Write("("); 4797Writer.Write(", "); 4799Writer.Write("true"); 4800Writer.Write(")"); 4812Writer.Write(isDoc ? "ReadXmlDocument(" : "ReadXmlNode("); 4813Writer.Write(element.Any ? "false" : "true"); 4814Writer.Write(")"); 4823Writer.Write(typeof(XmlQualifiedName).FullName); 4825Writer.Write("if (tser == null"); 4826Writer.Write(" || "); 4833Writer.Write("ReadSerializable(( "); 4834Writer.Write(typeof(IXmlSerializable).FullName); 4835Writer.Write(")"); 4838Writer.Write(RaCodeGen.GetStringForCreateInstance(sm.TypeDesc!.CSharpName, false, false, false, "\"default\"")); 4842Writer.Write(RaCodeGen.GetStringForCreateInstance(sm.TypeDesc!.CSharpName, sm.TypeDesc.UseReflection, sm.TypeDesc.CannotNew, false)); 4849Writer.Write(")"); 4876Writer.Write(choiceSource); 4877Writer.Write(" = "); 4879Writer.Write(RaCodeGen.GetStringForEnumMember(enumTypeName, choice.MemberIds[elementIndex], choice.Mapping.TypeDesc.UseReflection)); 4890Writer.Write("else if (tser == null"); 4891Writer.Write(" || "); 4902Writer.Write("ReadSerializable(( "); 4903Writer.Write(typeof(IXmlSerializable).FullName); 4904Writer.Write(")"); 4905Writer.Write(RaCodeGen.GetStringForCreateInstance(derived.TypeDesc!.CSharpName, derived.TypeDesc.UseReflection, derived.TypeDesc.CannotNew, false)); 4910Writer.Write(")"); 4916Writer.Write("throw CreateBadDerivationException("); 4918Writer.Write(", "); 4920Writer.Write(", "); 4922Writer.Write(", "); 4924Writer.Write(", "); 4926Writer.Write(", "); 4934Writer.Write("throw CreateMissingIXmlSerializableType("); 4936Writer.Write(", "); 4938Writer.Write(", "); 4953Writer.Write("while (Reader.NodeType != "); 4954Writer.Write(typeof(XmlNodeType).FullName); 4955Writer.Write(".EndElement && Reader.NodeType != "); 4956Writer.Write(typeof(XmlNodeType).FullName); 4969Writer.Write(length <= StackallocLimit ? 4972Writer.Write(length.ToString(CultureInfo.InvariantCulture)); 4979Writer.Write("while (Reader.NodeType == "); 4980Writer.Write(typeof(XmlNodeType).FullName); 4983Writer.Write("string root = Reader.GetAttribute(\"root\", \""); 4984Writer.Write(Soap.Encoding); 4986Writer.Write("if (root == null || "); 4987Writer.Write(typeof(XmlConvert).FullName); 4996Writer.Write(value ? "true" : "false"); 5001Writer.Write(typeof(ArrayList).FullName); 5002Writer.Write(" "); 5003Writer.Write(source); 5004Writer.Write(" = new "); 5005Writer.Write(typeof(ArrayList).FullName); 5008Writer.Write(typeof(ArrayList).FullName); 5009Writer.Write(" "); 5010Writer.Write(source); 5011Writer.Write("IsObject = new "); 5012Writer.Write(typeof(ArrayList).FullName); 5019Writer.Write("foreach (object obj in "); 5020Writer.Write(listSource); 5024Writer.Write("bool isObject = (bool)"); 5025Writer.Write(listSource); 5029Writer.Write(typeof(Type).FullName); 5042Writer.Write("if (Reader.GetAttribute(\"root\", \""); 5043Writer.Write(Soap.Encoding); 5057Writer.Write(useReflection ? "object" : fullTypeName); 5058Writer.Write(" "); 5059Writer.Write(local); 5067Writer.Write(local); 5068Writer.Write(" = "); 5069Writer.Write(RaCodeGen.GetStringForCreateInstance(fullTypeName, useReflection, mapping.TypeDesc.CannotNew, true)); 5075Writer.Write("throw CreateInaccessibleConstructorException("); 5082Writer.Write("throw CreateCtorHasSecurityException("); 5095Writer.Write("catch ("); 5096Writer.Write(exceptionType.FullName); 5104Writer.Write("throw CreateInvalidCastException("); 5105Writer.Write(RaCodeGen.GetStringForTypeof(typeDesc.CSharpName, typeDesc.UseReflection)); 5106Writer.Write(", "); 5107Writer.Write(source); 5112Writer.Write(", (string)"); 5113Writer.Write(id);
System\Xml\Serialization\XmlSerializationWriter.cs (480)
1639_writer.Write($"static {typeof(Type).FullName} {typeVariable} = {assemblyVariable}.GetType("); 1657_writer.Write($"static {typeof(Type).FullName} {typeVariable} = {assemblyVariable}.GetType("); 1685_writer.Write(string.Format(CultureInfo.InvariantCulture, HelperClassesForUseReflection, 1764_writer.Write($"static {typeof(Assembly).FullName} {assemblyVariable} = ResolveDynamicAssembly("); 1781_writer.Write($"static XSPropInfo {propVariable} = new XSPropInfo({typeVariable}, "); 1790_writer.Write($"static XSFieldInfo {fieldVariable} = new XSFieldInfo({typeVariable}, "); 1803_writer.Write($"static {typeof(MethodInfo).FullName} {methodVariable} = {typeVariable}.GetMethod("); 1805_writer.Write(", "); 1808_writer.Write(bindingFlags); 1809_writer.Write(".Public | "); 1810_writer.Write(bindingFlags); 1811_writer.Write(".Instance | "); 1812_writer.Write(bindingFlags); 1813_writer.Write(".Static"); 1817_writer.Write(" | "); 1818_writer.Write(bindingFlags); 1819_writer.Write(".NonPublic"); 1821_writer.Write(", null, "); 1822_writer.Write($"new {typeof(Type).FullName}[] {{ "); 1825_writer.Write(paramTypes[i]); 1827_writer.Write(", "); 1839_writer.Write("static XSArrayInfo "); 1840_writer.Write(itemVariable); 1841_writer.Write("= new XSArrayInfo("); 1842_writer.Write(GetStringForTypeof(CodeIdentifier.GetCSharpName(type), collectionUseReflection)); 1843_writer.Write(".GetProperty("); 1845_writer.Write(","); 1847_writer.Write(GetStringForTypeof(CodeIdentifier.GetCSharpName(defaultIndexer.PropertyType), elementUseReflection)); 1848_writer.Write(",new "); 1849_writer.Write(typeof(Type[]).FullName); 2050_writer.Write(typeFullName); 2051_writer.Write(" "); 2052_writer.Write(variableName); 2055_writer.Write(" = "); 2058_writer.Write($"({typeFullName})"); 2060_writer.Write(initValue); 2067_writer.Write(useReflection ? "object" : escapedName); 2068_writer.Write(" "); 2069_writer.Write(source); 2070_writer.Write(" = "); 2071_writer.Write(GetStringForCreateInstance(escapedName, useReflection, ctorInaccessible, !useReflection && ctorInaccessible)); 2078_writer.Write(source); 2079_writer.Write(" is "); 2080_writer.Write(escapedTypeName); 2083_writer.Write(GetReflectionVariable(escapedTypeName, null)); 2084_writer.Write(".IsAssignableFrom("); 2085_writer.Write(source); 2086_writer.Write(".GetType())"); 2100_writer.Write(typeName); 2101_writer.Write(" "); 2102_writer.Write(variableName); 2105_writer.Write(" = "); 2107_writer.Write($"({typeName})"); 2108_writer.Write(initValue); 2114_writer.Write("case "); 2117_writer.Write(c.Value.ToString(CultureInfo.InvariantCulture)); 2121_writer.Write(fullTypeName); 2122_writer.Write(".@"); 2124_writer.Write(c.Name); 2126_writer.Write(": "); 2130_writer.Write(variable); 2131_writer.Write(" == "); 2132_writer.Write(GetStringForTypeof(escapedTypeName, useReflection)); 2138_writer.Write(variable); 2139_writer.Write(" == typeof("); 2140_writer.Write(escapedTypeName); 2141_writer.Write(")"); 2144_writer.Write(variable); 2145_writer.Write(".IsArray "); 2146_writer.Write(" && "); 2154writer.Write("null"); 2157writer.Write("@\""); 2163writer.Write("\\r"); 2165writer.Write("\\n"); 2167writer.Write("\\t"); 2171writer.Write("\\x"); 2178writer.Write("\"\""); 2185writer.Write("\""); 2250Writer.Write(Access); 2251Writer.Write(" class "); 2252Writer.Write(ClassName); 2253Writer.Write(" : "); 2254Writer.Write(typeof(System.Xml.Serialization.XmlSerializationWriter).FullName); 2343Writer.Write("AddWriteCallback("); 2344Writer.Write(RaCodeGen.GetStringForTypeof(typeMapping.TypeDesc.CSharpName, typeMapping.TypeDesc.UseReflection)); 2345Writer.Write(", "); 2347Writer.Write(", "); 2349Writer.Write(", new "); 2350Writer.Write(typeof(System.Xml.Serialization.XmlSerializationWriteCallback).FullName); 2351Writer.Write("(this."); 2352Writer.Write(methodName); 2373Writer.Write(nullable ? ("WriteNullableQualifiedName" + suffix) : "WriteElementQualifiedName"); 2374Writer.Write("("); 2378Writer.Write(", "); 2381Writer.Write(", "); 2382Writer.Write(source); 2386Writer.Write(", new System.Xml.XmlQualifiedName("); 2388Writer.Write(", "); 2390Writer.Write(")"); 2411Writer.Write(methodName); 2412Writer.Write("("); 2413Writer.Write(source); 2414Writer.Write(")"); 2421Writer.Write(source); 2427Writer.Write(typeof(XmlConvert).FullName); 2428Writer.Write(".ToString(("); 2429Writer.Write(typeDesc.CSharpName); 2430Writer.Write(")"); 2431Writer.Write(source); 2432Writer.Write(")"); 2436Writer.Write("From"); 2437Writer.Write(typeDesc.FormatterName); 2438Writer.Write("("); 2439Writer.Write(source); 2440Writer.Write(")"); 2459Writer.Write("if ("); 2461Writer.Write(ReflectionAwareCodeGen.GetStringForEnumLongValue(source, mapping.TypeDesc.UseReflection)); 2463Writer.Write(source); 2464Writer.Write(" != "); 2467Writer.Write("("); 2475Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, values[i], mapping.TypeDesc.UseReflection)); 2477Writer.Write(")"); 2481Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, (string)defaultValue!, mapping.TypeDesc.UseReflection)); 2483Writer.Write(")"); 2493Writer.Write(method); 2494Writer.Write("("); 2498Writer.Write(", "); 2502Writer.Write(", "); 2515Writer.Write(", new System.Xml.XmlQualifiedName("); 2517Writer.Write(", "); 2519Writer.Write(")"); 2533Writer.Write(methodName); 2534Writer.Write("("); 2536Writer.Write(", "); 2539Writer.Write("null"); 2550Writer.Write(methodName); 2551Writer.Write("("); 2553Writer.Write(", "); 2556Writer.Write("null"); 2562Writer.Write(", null, "); 2564Writer.Write("true"); 2566Writer.Write("false"); 2581Writer.Write("WriteEndElement("); 2582Writer.Write(source); 2611Writer.Write("public void "); 2612Writer.Write(methodName); 2637Writer.Write("if (pLength > "); 2638Writer.Write(xmlnsMember.ToString(CultureInfo.InvariantCulture)); 2671Writer.Write("if (pLength > "); 2672Writer.Write(index); 2678Writer.Write("if (pLength <= "); 2679Writer.Write(specifiedPosition.ToString(CultureInfo.InvariantCulture)); 2680Writer.Write(" || "); 2681Writer.Write(specifiedSource); 2726Writer.Write("if (pLength > "); 2727Writer.Write(index); 2733Writer.Write("if (pLength <= "); 2734Writer.Write(specifiedPosition.ToString(CultureInfo.InvariantCulture)); 2735Writer.Write(" || "); 2736Writer.Write(specifiedSource); 2765Writer.Write("WriteRpcResult("); 2767Writer.Write(", "); 2794Writer.Write("if (pLength > "); 2795Writer.Write(mapping.Members.Length.ToString(CultureInfo.InvariantCulture)); 2818Writer.Write("public void "); 2819Writer.Write(methodName); 2868Writer.Write("void "); 2869Writer.Write(methodName); 2875Writer.Write("string "); 2876Writer.Write(methodName); 2877Writer.Write("("); 2878Writer.Write(mapping.TypeDesc.UseReflection ? "object" : fullTypeName); 2899Writer.Write("s = "); 2909Writer.Write("default: s = FromEnum("); 2910Writer.Write(ReflectionAwareCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection)); 2911Writer.Write(", new string[] {"); 2920Writer.Write("}, new "); 2921Writer.Write(typeof(long).FullName); 2922Writer.Write("[] {"); 2929Writer.Write("(long)"); 2931Writer.Write(c.Value.ToString(CultureInfo.InvariantCulture)); 2934Writer.Write(fullTypeName); 2935Writer.Write(".@"); 2937Writer.Write(c.Name); 2941Writer.Write("}, "); 2947Writer.Write("default: throw CreateInvalidEnumValueException("); 2948Writer.Write(ReflectionAwareCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection)); 2949Writer.Write(".ToString(System.Globalization.CultureInfo.InvariantCulture), "); 2958Writer.Write("WriteXsiType("); 2960Writer.Write(", "); 2978Writer.Write("if ("); 2990Writer.Write(methodName); 2991Writer.Write("(n, ns,"); 2992if (!derived.TypeDesc.UseReflection) Writer.Write($"({fullTypeName})"); 2993Writer.Write("o"); 2995Writer.Write(", isNullable"); 2996Writer.Write(", true"); 3017Writer.Write("if ("); 3029Writer.Write("WriteXsiType("); 3031Writer.Write(", "); 3034Writer.Write("Writer.WriteString("); 3035Writer.Write(methodName); 3036Writer.Write("("); 3037if (!mapping.TypeDesc.UseReflection) Writer.Write($"({fullTypeName})"); 3049Writer.Write("if ("); 3058Writer.Write("WriteXsiType("); 3060Writer.Write(", "); 3082Writer.Write("void "); 3083Writer.Write(methodName); 3095Writer.Write("(string n, string ns, "); 3096Writer.Write(mapping.TypeDesc.UseReflection ? "object" : fullTypeName); 3097Writer.Write(" o"); 3099Writer.Write(", bool isNullable"); 3114Writer.Write(typeof(Type).FullName); 3116Writer.Write("if ("); 3164Writer.Write("WriteStartElement(n, ns, o, false, "); 3166Writer.Write("null"); 3168Writer.Write(xmlnsSource); 3173Writer.Write("if (needType) WriteXsiType("); 3175Writer.Write(", "); 3192Writer.Write("if ("); 3195Writer.Write(methodInvoke); 3201Writer.Write("if ("); 3204Writer.Write(memberGet); 3233Writer.Write("if ("); 3236Writer.Write(methodInvoke); 3242Writer.Write("if ("); 3245Writer.Write(memberGet); 3306Writer.Write("Writer.WriteStartAttribute(null, "); 3308Writer.Write(", "); 3316Writer.Write("null"); 3322Writer.Write(typeof(StringBuilder).FullName); 3323Writer.Write(" sb = new "); 3324Writer.Write(typeof(StringBuilder).FullName); 3332Writer.Write(" e = "); 3333Writer.Write(typeof(IEnumerator).FullName); 3336Writer.Write("(("); 3337Writer.Write(typeof(IEnumerable).FullName); 3345Writer.Write("("); 3346Writer.Write(typeof(IEnumerator).FullName); 3347Writer.Write(")"); 3348Writer.Write(RaCodeGen.GetReflectionVariable(memberTypeDesc.CSharpName, "System.Collections.Generic.IEnumerable*")); 3353Writer.Write("((System.Collections.Generic.IEnumerable<"); 3354Writer.Write(arrayElementTypeDesc.CSharpName); 3362Writer.Write("("); 3363Writer.Write(typeof(IEnumerator).FullName); 3364Writer.Write(")"); 3366Writer.Write(RaCodeGen.GetStringForMethodInvoke("a", memberTypeDesc.CSharpName, "GetEnumerator", memberTypeDesc.UseReflection)); 3378Writer.Write("for (int i = 0; i < "); 3385Writer.Write("(("); 3386Writer.Write(typeof(ICollection).FullName); 3399Writer.Write("WriteValue("); 3404Writer.Write("sb.Append("); 3430Writer.Write("WriteAttribute("); 3432Writer.Write(", "); 3437Writer.Write(", "); 3466Writer.Write("WriteXmlAttribute("); 3467Writer.Write(source); 3468Writer.Write(", "); 3469Writer.Write(parent); 3514Writer.Write("throw CreateInvalidChoiceIdentifierValueException("); 3516Writer.Write(", "); 3518Writer.Write(");"); 3540Writer.Write(typeof(IEnumerator).FullName); 3541Writer.Write(" e = "); 3544Writer.Write("(("); 3545Writer.Write(typeof(IEnumerable).FullName); 3546Writer.Write(")"); 3547Writer.Write(arrayName); 3555Writer.Write("("); 3556Writer.Write(typeof(IEnumerator).FullName); 3557Writer.Write(")"); 3558Writer.Write(RaCodeGen.GetReflectionVariable(arrayTypeDesc.CSharpName, "System.Collections.Generic.IEnumerable*")); 3559Writer.Write(".Invoke("); 3560Writer.Write(arrayName); 3565Writer.Write("((System.Collections.Generic.IEnumerable<"); 3566Writer.Write(arrayElementTypeDesc.CSharpName); 3567Writer.Write(">)"); 3568Writer.Write(arrayName); 3576Writer.Write("("); 3577Writer.Write(typeof(IEnumerator).FullName); 3578Writer.Write(")"); 3580Writer.Write(RaCodeGen.GetStringForMethodInvoke(arrayName, arrayTypeDesc.CSharpName, "GetEnumerator", arrayTypeDesc.UseReflection)); 3592Writer.Write("for (int i"); 3593Writer.Write(arrayName); 3594Writer.Write(" = 0; i"); 3595Writer.Write(arrayName); 3596Writer.Write(" < "); 3599Writer.Write(arrayName); 3600Writer.Write(".Length"); 3604Writer.Write("(("); 3605Writer.Write(typeof(ICollection).FullName); 3606Writer.Write(")"); 3607Writer.Write(arrayName); 3608Writer.Write(").Count"); 3610Writer.Write("; i"); 3611Writer.Write(arrayName); 3656Writer.Write("if ((object)("); 3657Writer.Write(source); 3658Writer.Write(") != null)"); 3691if (wroteFirstIf) Writer.Write("else "); 3693Writer.Write("if ("); 3694Writer.Write(enumUseReflection ? ReflectionAwareCodeGen.GetStringForEnumLongValue(enumSource!, enumUseReflection) : enumSource); 3695Writer.Write(" == "); 3696Writer.Write(enumFullName); 3699Writer.Write(" && ((object)("); 3700Writer.Write(source); 3701Writer.Write(") != null)"); 3720if (wroteFirstIf) Writer.Write("else "); 3722Writer.Write("if ("); 3736if (elements.Length - anyCount > 0) Writer.Write("else "); 3740Writer.Write("if ("); 3741Writer.Write(source); 3742Writer.Write(" is "); 3743Writer.Write(fullTypeName); 3747Writer.Write(fullTypeName); 3748Writer.Write(" elem = ("); 3749Writer.Write(fullTypeName); 3750Writer.Write(")"); 3751Writer.Write(source); 3758if (c++ > 0) Writer.Write("else "); 3766Writer.Write("if ("); 3767Writer.Write(enumUseReflection ? ReflectionAwareCodeGen.GetStringForEnumLongValue(enumSource!, enumUseReflection) : enumSource); 3768Writer.Write(" == "); 3769Writer.Write(enumFullName); 3772Writer.Write(" && ((object)("); 3773Writer.Write(source); 3774Writer.Write(") != null)"); 3779Writer.Write("if (elem.Name == "); 3781Writer.Write(" && elem.NamespaceURI == "); 3796Writer.Write("throw CreateChoiceIdentifierValueException("); 3798Writer.Write(", "); 3834Writer.Write("else "); 3835Writer.Write("if ("); 3856Writer.Write("else "); 3860Writer.Write(" if ((object)("); 3861Writer.Write(source); 3862Writer.Write(") != null)"); 3868Writer.Write("throw CreateUnknownTypeException("); 3869Writer.Write(source); 3884Writer.Write("WriteValue("); 3900Writer.Write(source); 3916Writer.Write("if ("); 3917Writer.Write(source); 3942Writer.Write("WritePotentiallyReferencingElement("); 3944Writer.Write(", "); 3946Writer.Write(", "); 3947Writer.Write(source); 3950Writer.Write(", "); 3951Writer.Write(RaCodeGen.GetStringForTypeof(arrayMapping.TypeDesc!.CSharpName, arrayMapping.TypeDesc.UseReflection)); 3952Writer.Write(", true, "); 3956Writer.Write(", null, false, "); 3978Writer.Write("if ("); 3979Writer.Write(elementArrayName); 3980Writer.Write(" != null)"); 3986Writer.Write("for (int "); 3987Writer.Write(arrayIndex); 3988Writer.Write(" = 0; "); 3989Writer.Write(arrayIndex); 3990Writer.Write(" < "); 3994Writer.Write(elementArrayName); 3995Writer.Write(".Length"); 3999Writer.Write("(("); 4000Writer.Write(typeof(ICollection).FullName); 4001Writer.Write(")"); 4002Writer.Write(elementArrayName); 4003Writer.Write(").Count"); 4005Writer.Write("; "); 4006Writer.Write(arrayIndex); 4036Writer.Write("if ("); 4037Writer.Write(arrayName); 4038Writer.Write(" != null)"); 4057Writer.Write("Writer.WriteStartElement("); 4059Writer.Write(", "); 4062Writer.Write(methodName); 4063Writer.Write("("); 4064Writer.Write(source); 4089Writer.Write("WritePotentiallyReferencingElement("); 4091Writer.Write(", "); 4093Writer.Write(", "); 4094Writer.Write(source); 4097Writer.Write(", "); 4098Writer.Write(RaCodeGen.GetStringForTypeof(structMapping.TypeDesc!.CSharpName, structMapping.TypeDesc.UseReflection)); 4099Writer.Write(", true, "); 4103Writer.Write(", null, false, "); 4115Writer.Write(methodName); 4116Writer.Write("("); 4118Writer.Write(", "); 4120Writer.Write("null"); 4125Writer.Write(", "); 4126Writer.Write(source); 4129Writer.Write(", "); 4132Writer.Write(", false"); 4145Writer.Write("if (("); 4146Writer.Write(source); 4147Writer.Write(") is "); 4148Writer.Write(typeof(XmlNode).FullName); 4149Writer.Write(" || "); 4150Writer.Write(source); 4151Writer.Write(" == null"); 4162Writer.Write("throw CreateInvalidAnyTypeException("); 4163Writer.Write(source); 4178Writer.Write(func); 4179Writer.Write("(("); 4180Writer.Write(cast.FullName); 4181Writer.Write(")"); 4182Writer.Write(source); 4183Writer.Write(", "); 4185Writer.Write(", "); 4187Writer.Write(", "); 4189Writer.Write(", "); 4197Writer.Write("if ("); 4202Writer.Write("("); 4203Writer.Write(source); 4205Writer.Write(" == null) || ("); 4207Writer.Write(" != null) && ("); 4208Writer.Write(source); 4209Writer.Write(".Length != 0)"); 4213Writer.Write("!"); 4214Writer.Write(source); 4215Writer.Write(".Equals("); 4218Writer.Write(")"); 4222Writer.Write(source); 4223Writer.Write(" != "); 4227Writer.Write(")"); 4232Writer.Write("if (((object)"); 4233Writer.Write(source); 4234Writer.Write(") != null && !("); 4236Writer.Write(")) throw CreateMismatchChoiceException("); 4238Writer.Write(", "); 4240Writer.Write(", "); 4247Writer.Write("if ((object)("); 4248Writer.Write(source); 4262Writer.Write("null"); 4278Writer.Write("\'"); 4284Writer.Write(((int)value).ToString(null, NumberFormatInfo.InvariantInfo)); 4289Writer.Write("System.Double.NaN"); 4293Writer.Write("System.Double.PositiveInfinity"); 4297Writer.Write("System.Double.NegativeInfinity"); 4301Writer.Write(((double)value).ToString("R", NumberFormatInfo.InvariantInfo)); 4305Writer.Write((bool)value ? "true" : "false"); 4308Writer.Write("("); 4309Writer.Write(type.FullName); 4310Writer.Write(")"); 4311Writer.Write("("); 4312Writer.Write(Convert.ToString(value, NumberFormatInfo.InvariantInfo)); 4313Writer.Write(")"); 4319Writer.Write("System.Single.NaN"); 4323Writer.Write("System.Single.PositiveInfinity"); 4327Writer.Write("System.Single.NegativeInfinity"); 4331Writer.Write(((float)value).ToString("R", NumberFormatInfo.InvariantInfo)); 4332Writer.Write("f"); 4337Writer.Write(((decimal)value).ToString(null, NumberFormatInfo.InvariantInfo)); 4338Writer.Write("m"); 4342Writer.Write(" new "); 4343Writer.Write(type.FullName); 4344Writer.Write("("); 4345Writer.Write(((DateTime)value).Ticks.ToString(CultureInfo.InvariantCulture)); 4346Writer.Write(")"); 4350Writer.Write(" new "); 4351Writer.Write(type.FullName); 4352Writer.Write("("); 4353Writer.Write(((DateTimeOffset)value).Ticks.ToString(CultureInfo.InvariantCulture)); 4354Writer.Write(", new "); 4355Writer.Write(((DateTimeOffset)value).Offset.GetType().FullName); 4356Writer.Write("("); 4357Writer.Write(((DateTimeOffset)value).Offset.Ticks.ToString(CultureInfo.InvariantCulture)); 4358Writer.Write("))"); 4362Writer.Write(" new "); 4363Writer.Write(type.FullName); 4364Writer.Write("("); 4365Writer.Write(((TimeSpan)value).Ticks.ToString(CultureInfo.InvariantCulture)); 4366Writer.Write(")"); 4372Writer.Write(((int)value).ToString(null, NumberFormatInfo.InvariantInfo)); 4385Writer.Write("WriteNamespaceDeclarations("); 4386Writer.Write(source); 4403Writer.Write("for (int i = "); 4404Writer.Write(loopStartSource); 4405Writer.Write("; i < "); 4406Writer.Write(loopEndSource);