1669 references to Writer
System.Private.Xml (1669)
System\Xml\Serialization\XmlSerializationReader.cs (940)
2233Writer.Write(Access); 2234Writer.Write(" class "); 2235Writer.Write(ClassName); 2236Writer.Write(" : "); 2237Writer.Write(typeof(System.Xml.Serialization.XmlSerializationReader).FullName); 2238Writer.WriteLine(" {"); 2239Writer.Indent++; 2300Writer.WriteLine(); 2303Writer.Write("string "); 2304Writer.Write(idName); 2305Writer.WriteLine(";"); 2308Writer.WriteLine(); 2309Writer.WriteLine("protected override void InitIDs() {"); 2310Writer.Indent++; 2315Writer.Write(idName); 2316Writer.Write(" = Reader.NameTable.Add("); 2318Writer.WriteLine(");"); 2320Writer.Indent--; 2321Writer.WriteLine("}"); 2323Writer.Indent--; 2324Writer.WriteLine("}"); 2343Writer.Write("if (Reader.IsStartElement("); 2345Writer.Write(", "); 2347Writer.WriteLine(")) {"); 2348Writer.Indent++; 2355Writer.WriteLine("else {"); 2356Writer.Indent++; 2358Writer.Write(func); 2359Writer.Write("("); 2360Writer.Write(node); 2363Writer.Write(", "); 2367ReflectionAwareCodeGen.WriteQuotedCSharpString(Writer, expectedElement); 2369Writer.WriteLine(");"); 2372Writer.Indent--; 2373Writer.WriteLine("}"); 2379Writer.WriteLine(); 2380Writer.WriteLine("protected override void InitCallbacks() {"); 2381Writer.Indent++; 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); 2412Writer.WriteLine("));"); 2417Writer.Indent--; 2418Writer.WriteLine("}"); 2422Writer.WriteLine(); 2423Writer.Write("object "); 2424Writer.Write(dummyArrayMethodName); 2425Writer.WriteLine("() {"); 2426Writer.Indent++; 2427Writer.WriteLine("// dummy array method"); 2428Writer.WriteLine("UnknownNode(null);"); 2429Writer.WriteLine("return null;"); 2430Writer.Indent--; 2431Writer.WriteLine("}"); 2479Writer.WriteLine(); 2480Writer.Write("public object[] "); 2481Writer.Write(methodName); 2482Writer.WriteLine("() {"); 2483Writer.Indent++; 2484Writer.WriteLine("Reader.MoveToContent();"); 2486Writer.Write("object[] p = new object["); 2487Writer.Write(mappings.Length.ToString(CultureInfo.InvariantCulture)); 2488Writer.WriteLine("];"); 2494Writer.Indent++; 2572if (members.Length > 0 && members[0].Mapping.IsReturnValue) Writer.WriteLine("IsReturnValue = true;"); 2582Writer.WriteLine("Reader.MoveToElement();"); 2589Writer.WriteLine("if (Reader.IsEmptyElement) { Reader.Skip(); Reader.MoveToContent(); continue; }"); 2590Writer.WriteLine("Reader.ReadStartElement();"); 2594Writer.WriteLine("int state = 0;"); 2597Writer.Indent++; 2602Writer.WriteLine("Reader.MoveToContent();"); 2609Writer.WriteLine("ReadEndElement();"); 2611Writer.Indent--; 2612Writer.WriteLine("}"); 2616Writer.WriteLine("Reader.MoveToContent();"); 2620Writer.WriteLine("return p;"); 2621Writer.Indent--; 2622Writer.WriteLine("}"); 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)); 2646Writer.WriteLine(";"); 2658Writer.WriteLine(); 2659Writer.Write("public object[] "); 2660Writer.Write(methodName); 2661Writer.WriteLine("() {"); 2662Writer.Indent++; 2664Writer.WriteLine("Reader.MoveToContent();"); 2666Writer.Write("object[] p = new object["); 2667Writer.Write(mappings.Length.ToString(CultureInfo.InvariantCulture)); 2668Writer.WriteLine("];"); 2677Writer.Write("if (!"); 2679Writer.WriteLine(") throw CreateUnknownNodeException();"); 2681Writer.WriteLine("bool isEmptyWrapper = Reader.IsEmptyElement;"); 2682Writer.WriteLine("Reader.ReadStartElement();"); 2717if (members.Length > 0 && members[0].Mapping.IsReturnValue) Writer.WriteLine("IsReturnValue = true;"); 2725Writer.Indent++; 2729Writer.WriteLine("Reader.MoveToContent();"); 2734Writer.WriteLine("if (!isEmptyWrapper) ReadEndElement();"); 2739Writer.WriteLine("ReadReferencedElements();"); 2740Writer.WriteLine("return p;"); 2742Writer.Indent--; 2743Writer.WriteLine("}"); 2760Writer.Write(item); 2761Writer.Write(" "); 2762Writer.Write("ci ="); 2763Writer.Write($"({item})"); 2764Writer.Write(source); 2765Writer.WriteLine(";"); 2767Writer.WriteLine("for (int i = 0; i < ci.Length; i++) {"); 2768Writer.Indent++; 2769Writer.Write(RaCodeGen.GetStringForMethod("c", td.CSharpName, "Add", useReflection)); 2774Writer.Write("ci[i]"); 2776Writer.Write($"{RaCodeGen.GetReflectionVariable(typeof(Array).FullName!, "0")}[ci , i]"); 2779if (useReflection) Writer.WriteLine("}"); 2780Writer.WriteLine(");"); 2781Writer.Indent--; 2782Writer.WriteLine("}"); 2790Writer.WriteLine(); 2791Writer.Write("public object "); 2792Writer.Write(methodName); 2793Writer.WriteLine("() {"); 2794Writer.Indent++; 2795Writer.WriteLine("object o = null;"); 2801Writer.WriteLine("Reader.MoveToContent();"); 2806Writer.WriteLine("Referenced(o);"); 2807Writer.WriteLine("ReadReferencedElements();"); 2809Writer.WriteLine("return (object)o;"); 2810Writer.Indent--; 2811Writer.WriteLine("}"); 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(")"); 2902Writer.WriteLine(); 2903Writer.Write(typeof(Hashtable).FullName); 2904Writer.Write(" "); 2905Writer.Write(memberName); 2906Writer.WriteLine(";"); 2907Writer.WriteLine(); 2909Writer.Write("internal "); 2910Writer.Write(typeof(Hashtable).FullName); 2911Writer.Write(" "); 2912Writer.Write(propName); 2913Writer.WriteLine(" {"); 2914Writer.Indent++; 2916Writer.WriteLine("get {"); 2917Writer.Indent++; 2919Writer.Write("if ((object)"); 2920Writer.Write(memberName); 2921Writer.WriteLine(" == null) {"); 2922Writer.Indent++; 2924Writer.Write(typeof(Hashtable).FullName); 2925Writer.Write(" h = new "); 2926Writer.Write(typeof(Hashtable).FullName); 2927Writer.WriteLine("();"); 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")); 2949Writer.WriteLine(");"); 2952Writer.Write(memberName); 2953Writer.WriteLine(" = h;"); 2955Writer.Indent--; 2956Writer.WriteLine("}"); 2958Writer.Write("return "); 2959Writer.Write(memberName); 2960Writer.WriteLine(";"); 2962Writer.Indent--; 2963Writer.WriteLine("}"); 2965Writer.Indent--; 2966Writer.WriteLine("}"); 2978Writer.WriteLine(); 2984Writer.Write("object"); 2985Writer.Write(" "); 2986Writer.Write(methodName); 2987Writer.WriteLine("() {"); 2988Writer.Indent++; 2989Writer.WriteLine("string s = Reader.ReadElementString();"); 2993Writer.Write(useReflection ? "object" : fullTypeName); 2994Writer.Write(" "); 2995Writer.Write(methodName); 2996Writer.WriteLine("(string s) {"); 2997Writer.Indent++; 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(", "); 3013Writer.WriteLine("));"); 3017Writer.Write("return ("); 3018Writer.Write(fullTypeName); 3019Writer.Write(")ToEnum(s, "); 3020Writer.Write(tableName); 3021Writer.Write(", "); 3023Writer.WriteLine(");"); 3028Writer.WriteLine("switch (s) {"); 3029Writer.Indent++; 3038Writer.Write("case "); 3040Writer.Write(": return "); 3041Writer.Write(RaCodeGen.GetStringForEnumMember(fullTypeName, c.Name, useReflection)); 3042Writer.WriteLine(";"); 3047Writer.Write("default: throw CreateUnknownConstantException(s, "); 3048Writer.Write(RaCodeGen.GetStringForTypeof(fullTypeName, useReflection)); 3049Writer.WriteLine(");"); 3050Writer.Indent--; 3051Writer.WriteLine("}"); 3054Writer.Indent--; 3055Writer.WriteLine("}"); 3062Writer.Write("if ("); 3064Writer.WriteLine(")"); 3065Writer.Indent++; 3073Writer.Write("return "); 3075Writer.Write($"({returnTypeName})"); 3076Writer.Write(methodName); 3077Writer.Write("("); 3079Writer.Write("isNullable, "); 3080Writer.WriteLine("false);"); 3082Writer.Indent--; 3099Writer.Write("if ("); 3101Writer.WriteLine(") {"); 3102Writer.Indent++; 3103Writer.WriteLine("Reader.ReadStartElement();"); 3109Writer.Write("object e = "); 3110Writer.Write(methodName); 3111Writer.WriteLine("(CollapseWhitespace(Reader.ReadString()));"); 3112Writer.WriteLine("ReadEndElement();"); 3113Writer.WriteLine("return e;"); 3114Writer.Indent--; 3115Writer.WriteLine("}"); 3121Writer.Write("if ("); 3123Writer.WriteLine(") {"); 3124Writer.Indent++; 3135Writer.Write(typeof(Array).FullName); 3137Writer.Write("object"); 3140Writer.Write(fullTypeName); 3141Writer.Write(" a = "); 3144Writer.Write(RaCodeGen.GetStringForCreateInstance(fullTypeName, td.UseReflection, false, false)); 3145Writer.WriteLine(";"); 3148Writer.WriteLine("null;"); 3151Writer.WriteLine("return a;"); 3152Writer.Indent--; 3153Writer.WriteLine("}"); 3165Writer.WriteLine(); 3167Writer.Write(typeName); 3168Writer.Write(" "); 3169Writer.Write(methodName); 3170Writer.WriteLine("(bool checkType) {"); 3171Writer.Indent++; 3173Writer.Write(typeName); 3174Writer.Write(" o = "); 3178Writer.Write("null"); 3182Writer.Write("default("); 3183Writer.Write(typeName); 3184Writer.Write(")"); 3186Writer.WriteLine(";"); 3188Writer.WriteLine("if (ReadNull())"); 3189Writer.Indent++; 3191Writer.WriteLine("return o;"); 3192Writer.Indent--; 3200Writer.WriteLine("return o;"); 3202Writer.Indent--; 3203Writer.WriteLine("}"); 3219Writer.WriteLine(); 3220Writer.Write(typeName); 3221Writer.Write(" "); 3222Writer.Write(methodName); 3223Writer.Write("("); 3225Writer.Write("bool isNullable, "); 3226Writer.WriteLine("bool checkType) {"); 3227Writer.Indent++; 3229Writer.Write(typeof(XmlQualifiedName).FullName); 3230Writer.WriteLine(" xsiType = checkType ? GetXsiType() : null;"); 3231Writer.WriteLine("bool isNull = false;"); 3233Writer.WriteLine("if (isNullable) isNull = ReadNull();"); 3235Writer.WriteLine("if (checkType) {"); 3238Writer.Indent++; 3239Writer.WriteLine("if (isNull) {"); 3240Writer.Indent++; 3241Writer.WriteLine($"if (xsiType != null) return ({typeName})ReadTypedNull(xsiType);"); 3242Writer.Write("else return "); 3245Writer.Write(RaCodeGen.GetStringForCreateInstance(structMapping.TypeDesc.CSharpName, useReflection, false, false)); 3246Writer.WriteLine(";"); 3249Writer.WriteLine("null;"); 3251Writer.Indent--; 3252Writer.WriteLine("}"); 3254Writer.Write("if (xsiType == null"); 3257Writer.Write(" || "); 3260Writer.WriteLine(") {"); 3263Writer.Indent++; 3264Writer.WriteLine($"return ReadTypedPrimitive(new System.Xml.XmlQualifiedName(\"{Soap.UrType}\", \"{XmlSchema.Namespace}\"));"); 3265Writer.Indent--; 3267Writer.WriteLine("}"); 3268Writer.WriteLine("else {"); 3269Writer.Indent++; 3273Writer.Write("return ReadTypedPrimitive(("); 3275Writer.Write("throw CreateUnknownTypeException(("); 3276Writer.Write(typeof(XmlQualifiedName).FullName); 3277Writer.WriteLine(")xsiType);"); 3278Writer.Indent--; 3279Writer.WriteLine("}"); 3281Writer.Indent--; 3282Writer.WriteLine("}"); 3284Writer.WriteLine("if (isNull) return null;"); 3288Writer.Write("throw CreateAbstractTypeException("); 3290Writer.Write(", "); 3292Writer.WriteLine(");"); 3298Writer.WriteLine("DecodeName = false;"); 3388Writer.WriteLine("Reader.MoveToElement();"); 3390Writer.WriteLine("if (Reader.IsEmptyElement) {"); 3391Writer.Indent++; 3392Writer.WriteLine("Reader.Skip();"); 3394Writer.WriteLine("return o;"); 3395Writer.Indent--; 3396Writer.WriteLine("}"); 3398Writer.WriteLine("Reader.ReadStartElement();"); 3401Writer.WriteLine("int state = 0;"); 3404Writer.Indent++; 3407Writer.WriteLine("Reader.MoveToContent();"); 3412Writer.WriteLine("ReadEndElement();"); 3413Writer.WriteLine("return o;"); 3415Writer.Indent--; 3416Writer.WriteLine("}"); 3424Writer.WriteLine(); 3425Writer.Write("object"); 3426Writer.Write(" "); 3427Writer.Write(methodName); 3428Writer.Write("("); 3429Writer.WriteLine(") {"); 3430Writer.Indent++; 3438Writer.Write("throw CreateAbstractTypeException("); 3440Writer.Write(", "); 3442Writer.WriteLine(");"); 3473Writer.WriteLine("Reader.MoveToElement();"); 3475Writer.WriteLine("if (Reader.IsEmptyElement) { Reader.Skip(); return o; }"); 3476Writer.WriteLine("Reader.ReadStartElement();"); 3479Writer.Indent++; 3482Writer.WriteLine("Reader.MoveToContent();"); 3486Writer.WriteLine("ReadEndElement();"); 3487Writer.WriteLine("return o;"); 3489Writer.Indent--; 3490Writer.WriteLine("}"); 3497Writer.WriteLine(); 3498Writer.Write("void "); 3499Writer.Write(fixupMethodName); 3500Writer.WriteLine("(object objFixup) {"); 3501Writer.Indent++; 3502Writer.WriteLine("Fixup fixup = (Fixup)objFixup;"); 3504Writer.WriteLine("string[] ids = fixup.Ids;"); 3512Writer.Write("if (ids["); 3513Writer.Write(fixupIndex); 3514Writer.WriteLine("] != null) {"); 3515Writer.Indent++; 3529Writer.WriteLine("try {"); 3530Writer.Indent++; 3536Writer.Write(targetSource); 3538Writer.WriteLine(";"); 3542Writer.Write(member.CheckSpecifiedSource); 3543Writer.WriteLine(" = true;"); 3551Writer.Indent--; 3552Writer.WriteLine("}"); 3555Writer.Indent--; 3556Writer.WriteLine("}"); 3561Writer.WriteLine("// get array of the collection items"); 3570Writer.Write("if ((object)("); 3571Writer.Write(memberSource); 3572Writer.WriteLine(") == null) {"); 3573Writer.Indent++; 3577Writer.Write("throw CreateReadOnlyCollectionException("); 3579Writer.WriteLine(");"); 3583Writer.Write(memberSource); 3584Writer.Write(" = "); 3585Writer.Write(RaCodeGen.GetStringForCreateInstance(typeDesc.CSharpName, typeDesc.UseReflection, typeDesc.CannotNew, true)); 3586Writer.WriteLine(";"); 3589Writer.Indent--; 3590Writer.WriteLine("}"); 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); 3601Writer.WriteLine(");"); 3602Writer.WriteLine("AddFixup(collectionFixup);"); 3607Writer.Write("void "); 3608Writer.Write(c.Name); 3609Writer.WriteLine("(object collection, object collectionItems) {"); 3610Writer.Indent++; 3612Writer.WriteLine("if (collectionItems == null) return;"); 3613Writer.WriteLine("if (collection == null) return;"); 3622Writer.Indent--; 3623Writer.WriteLine("}"); 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); 3679Writer.WriteLine("while (Reader.MoveToNextAttribute()) {"); 3680Writer.Indent++; 3700Writer.Write("else "); 3702Writer.Write("if ("); 3705Writer.Write("!"); 3706Writer.Write(member.ParamsReadSource); 3707Writer.Write(" && "); 3716Writer.WriteLine(") {"); 3717Writer.Indent++; 3720Writer.Indent--; 3721Writer.WriteLine("}"); 3725Writer.Write("else "); 3729Writer.WriteLine("if (IsXmlnsAttribute(Reader.Name)) {"); 3730Writer.Indent++; 3732Writer.Write("if ("); 3733Writer.Write(xmlnsMember.Source); 3734Writer.Write(" == null) "); 3735Writer.Write(xmlnsMember.Source); 3736Writer.Write(" = new "); 3737Writer.Write(xmlnsMember.Mapping.TypeDesc!.CSharpName); 3738Writer.WriteLine("();"); 3741Writer.Write($"(({xmlnsMember.Mapping.TypeDesc.CSharpName}){xmlnsMember.ArraySource})"); 3742Writer.WriteLine(".Add(Reader.Name.Length == 5 ? \"\" : Reader.LocalName, Reader.Value);"); 3744Writer.Indent--; 3745Writer.WriteLine("}"); 3747Writer.WriteLine("else {"); 3748Writer.Indent++; 3752Writer.WriteLine("if (!IsXmlnsAttribute(Reader.Name)) {"); 3753Writer.Indent++; 3757Writer.Write(typeof(XmlAttribute).FullName); 3758Writer.Write(" attr = "); 3759Writer.Write("("); 3760Writer.Write(typeof(XmlAttribute).FullName); 3761Writer.WriteLine(") Document.ReadNode(Reader);"); 3762Writer.WriteLine("ParseWsdlArrayType(attr);"); 3767Writer.Write(elseCall); 3768Writer.Write("("); 3769Writer.Write(firstParam); 3772Writer.Write(", "); 3784Writer.WriteLine(");"); 3786Writer.Indent--; 3787Writer.WriteLine("}"); 3789Writer.Indent--; 3790Writer.WriteLine("}"); 3802Writer.Write("attr"); 3804Writer.WriteLine(";"); 3808Writer.Write("if (attr is "); 3809Writer.Write(typeof(XmlAttribute).FullName); 3810Writer.WriteLine(") {"); 3811Writer.Indent++; 3813Writer.Write("("); 3814Writer.Write(typeof(XmlAttribute).FullName); 3815Writer.Write(")attr"); 3817Writer.WriteLine(";"); 3818Writer.Indent--; 3819Writer.WriteLine("}"); 3828Writer.WriteLine("string listValues = Reader.Value;"); 3829Writer.WriteLine("string[] vals = listValues.Split(null);"); 3830Writer.WriteLine("for (int i = 0; i < vals.Length; i++) {"); 3831Writer.Indent++; 3838Writer.WriteLine(";"); 3839Writer.Indent--; 3840Writer.WriteLine("}"); 3847Writer.WriteLine(";"); 3852Writer.Write(member.CheckSpecifiedSource); 3853Writer.WriteLine(" = true;"); 3857Writer.Write(member.ParamsReadSource); 3858Writer.WriteLine(" = true;"); 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)); 3890Writer.WriteLine(");"); 3891Writer.WriteLine("AddFixup(fixup);"); 3915Writer.Write("int "); 3916Writer.Write(c); 3917Writer.WriteLine(" = 0;"); 3924Writer.Write("int c"); 3925Writer.Write(member.ChoiceArrayName); 3926Writer.WriteLine(" = 0;"); 3935Writer.Write(member.Source); 3936Writer.Write(a); 3938Writer.WriteLine("});"); 3940Writer.WriteLine(");"); 3947Writer.Write("if ((object)("); 3948Writer.Write(member.Source); 3949Writer.Write(") == null) "); 3952Writer.Write("throw CreateReadOnlyCollectionException("); 3954Writer.WriteLine(");"); 3958Writer.Write(member.Source); 3959Writer.Write(" = "); 3960Writer.Write(RaCodeGen.GetStringForCreateInstance(typeDescFullName, useReflection, typeDesc.CannotNew, true)); 3961Writer.WriteLine(";"); 4012Writer.WriteLine("string tmp = null;"); 4015Writer.Write("if (Reader.NodeType == "); 4016Writer.Write(typeof(XmlNodeType).FullName); 4017Writer.WriteLine(".Element) {"); 4018Writer.Indent++; 4030Writer.Indent--; 4031Writer.WriteLine("}"); 4036Writer.WriteLine("else {"); 4037Writer.Indent++; 4038Writer.WriteLine(elseString); 4039Writer.Indent--; 4040Writer.WriteLine("}"); 4045Writer.Write("else if (Reader.NodeType == "); 4046Writer.Write(typeof(XmlNodeType).FullName); 4047Writer.WriteLine(".Text || "); 4048Writer.Write("Reader.NodeType == "); 4049Writer.Write(typeof(XmlNodeType).FullName); 4050Writer.WriteLine(".CDATA || "); 4051Writer.Write("Reader.NodeType == "); 4052Writer.Write(typeof(XmlNodeType).FullName); 4053Writer.WriteLine(".Whitespace || "); 4054Writer.Write("Reader.NodeType == "); 4055Writer.Write(typeof(XmlNodeType).FullName); 4056Writer.WriteLine(".SignificantWhitespace) {"); 4057Writer.Indent++; 4065Writer.Write(elseString); 4066Writer.WriteLine(";"); 4068Writer.Indent--; 4069Writer.WriteLine("}"); 4082Writer.Write("Document.CreateTextNode(Reader.ReadString())"); 4096Writer.Write("CollapseWhitespace(Reader.ReadString())"); 4100Writer.Write("Reader.ReadString()"); 4107Writer.Write("tmp = ReadString(tmp, "); 4109Writer.WriteLine("true);"); 4111Writer.WriteLine("false);"); 4114Writer.Write("tmp"); 4125Writer.WriteLine(";"); 4130Writer.WriteLine("string refElemId = null;"); 4131Writer.WriteLine("object refElem = ReadReferencingElement(null, null, true, out refElemId);"); 4133Writer.WriteLine("if (refElemId != null) {"); 4134Writer.Indent++; 4135Writer.Write(checkTypeHrefsSource); 4136Writer.WriteLine(".Add(refElemId);"); 4137Writer.Write(checkTypeHrefsSource); 4138Writer.WriteLine("IsObject.Add(false);"); 4139Writer.Indent--; 4140Writer.WriteLine("}"); 4141Writer.WriteLine("else if (refElem != null) {"); 4142Writer.Indent++; 4143Writer.Write(checkTypeHrefsSource); 4144Writer.WriteLine(".Add(refElem);"); 4145Writer.Write(checkTypeHrefsSource); 4146Writer.WriteLine("IsObject.Add(true);"); 4147Writer.Indent--; 4148Writer.WriteLine("}"); 4168Writer.WriteLine(elementElseString); 4190Writer.WriteLine("switch (state) {"); 4217Writer.WriteLine("do {"); 4218Writer.Indent++; 4225Writer.Write("else "); 4229Writer.Write("case "); 4230Writer.Write(cases.ToString(CultureInfo.InvariantCulture)); 4231Writer.WriteLine(":"); 4232Writer.Indent++; 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(")"); 4274Writer.WriteLine(") {"); 4275Writer.Indent++; 4280Writer.Write("if ("); 4281Writer.Write(checkTypeSource); 4282Writer.WriteLine(" != null) {"); 4283Writer.Indent++; 4289Writer.Write(RaCodeGen.GetStringForCreateInstance(e.Mapping.TypeDesc.CSharpName, e.Mapping.TypeDesc.UseReflection, false, true, $"({td.CSharpName}){checkTypeSource}")); 4294Writer.Write(checkTypeSource); 4297Writer.WriteLine(";"); 4300Writer.Indent--; 4301Writer.WriteLine("}"); 4305Writer.Write("fixup.Ids["); 4306Writer.Write(member.FixupIndex.ToString(CultureInfo.InvariantCulture)); 4307Writer.Write("] = "); 4308Writer.Write(checkTypeSource); 4309Writer.WriteLine("Id;"); 4317Writer.WriteLine("IsReturnValue = false;"); 4320Writer.Write(member.ParamsReadSource); 4321Writer.WriteLine(" = true;"); 4325Writer.WriteLine("break;"); 4327Writer.Indent--; 4328Writer.WriteLine("}"); 4334Writer.WriteLine("else {"); 4335Writer.Indent++; 4338Writer.Write("state = "); 4339Writer.Write(cases.ToString(CultureInfo.InvariantCulture)); 4340Writer.WriteLine(";"); 4343Writer.Indent--; 4344Writer.WriteLine("}"); 4346Writer.WriteLine("break;"); 4347Writer.Indent--; 4354Writer.WriteLine("default:"); 4355Writer.Indent++; 4363Writer.WriteLine("break;"); 4365Writer.Indent--; 4368Writer.WriteLine("} while (false);"); 4372Writer.WriteLine("}"); 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(")"); 4452Writer.WriteLine(";"); 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(")"); 4474Writer.WriteLine(";"); 4479Writer.Write(member.Source); 4480Writer.Write(" = "); 4481Writer.Write(member.ArrayName); 4482Writer.WriteLine(";"); 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("]"); 4533Writer.WriteLine(");"); 4538Writer.WriteLine("if (rre != null) {"); 4539Writer.Indent++; 4541Writer.Indent--; 4542Writer.WriteLine("}"); 4546Writer.WriteLine("try {"); 4547Writer.Indent++; 4549Writer.Write("rre"); 4551Writer.WriteLine(";"); 4557Writer.WriteLine("if (!ReadNull()) {"); 4558Writer.Indent++; 4572Writer.Write("if (((object)("); 4573Writer.Write(member.ArrayName); 4574Writer.Write(") == null) || "); 4578Writer.Write("if ("); 4580Writer.WriteLine("(Reader.IsEmptyElement)) {"); 4581Writer.Indent++; 4582Writer.WriteLine("Reader.Skip();"); 4583Writer.Indent--; 4584Writer.WriteLine("}"); 4585Writer.WriteLine("else {"); 4586Writer.Indent++; 4588Writer.WriteLine("Reader.ReadStartElement();"); 4590Writer.Indent++; 4594Writer.WriteLine("Reader.MoveToContent();"); 4597Writer.Indent--; 4598Writer.WriteLine("ReadEndElement();"); 4599Writer.WriteLine("}"); 4603Writer.Indent--; 4604Writer.WriteLine("}"); 4607Writer.WriteLine("else {"); 4608Writer.Indent++; 4612Writer.Indent--; 4613Writer.WriteLine("}"); 4622Writer.Write(checkSpecified); 4623Writer.WriteLine(" = true;"); 4638Writer.Write(methodName); 4639Writer.Write("(true)"); 4641Writer.WriteLine(";"); 4647Writer.WriteLine("if (ReadNull()) {"); 4648Writer.Indent++; 4652Writer.Write(RaCodeGen.GetStringForCreateInstance(element.Mapping.TypeDesc.CSharpName, element.Mapping.TypeDesc.UseReflection, false, false)); 4656Writer.Write("null"); 4659Writer.WriteLine(";"); 4660Writer.Indent--; 4661Writer.WriteLine("}"); 4662Writer.Write("else "); 4666Writer.WriteLine("if (Reader.IsEmptyElement) {"); 4667Writer.Indent++; 4668Writer.WriteLine("Reader.Skip();"); 4669Writer.Indent--; 4670Writer.WriteLine("}"); 4671Writer.WriteLine("else {"); 4675Writer.WriteLine("{"); 4677Writer.Indent++; 4681Writer.WriteLine("if (Reader.IsEmptyElement) {"); 4682Writer.Indent++; 4683Writer.WriteLine("Reader.Skip();"); 4687Writer.Write("default(System.TimeSpan)"); 4691Writer.Write("default(System.DateTimeOffset)"); 4694Writer.WriteLine(";"); 4695Writer.Indent--; 4696Writer.WriteLine("}"); 4697Writer.WriteLine("else {"); 4698Writer.Indent++; 4702Writer.WriteLine(";"); 4703Writer.Indent--; 4704Writer.WriteLine("}"); 4710Writer.Write("ReadElementQualifiedName()"); 4728Writer.WriteLine(";"); 4730Writer.Indent--; 4731Writer.WriteLine("}"); 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(")"); 4753Writer.WriteLine(";"); 4757Writer.WriteLine("if (rre != null) {"); 4758Writer.Indent++; 4761Writer.WriteLine("try {"); 4762Writer.Indent++; 4764Writer.Write("rre"); 4766Writer.WriteLine(";"); 4768Writer.Write("Referenced("); 4769Writer.Write(source); 4770Writer.WriteLine(");"); 4773Writer.Indent--; 4774Writer.WriteLine("}"); 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(")"); 4802Writer.WriteLine(";"); 4812Writer.Write(isDoc ? "ReadXmlDocument(" : "ReadXmlNode("); 4813Writer.Write(element.Any ? "false" : "true"); 4814Writer.Write(")"); 4816Writer.WriteLine(";"); 4823Writer.Write(typeof(XmlQualifiedName).FullName); 4824Writer.WriteLine(" tser = GetXsiType();"); 4825Writer.Write("if (tser == null"); 4826Writer.Write(" || "); 4829Writer.WriteLine(") {"); 4830Writer.Indent++; 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)); 4847Writer.WriteLine(", true"); 4849Writer.Write(")"); 4851Writer.WriteLine(";"); 4854Writer.Indent--; 4855Writer.WriteLine("}"); 4876Writer.Write(choiceSource); 4877Writer.Write(" = "); 4879Writer.Write(RaCodeGen.GetStringForEnumMember(enumTypeName, choice.MemberIds[elementIndex], choice.Mapping.TypeDesc.UseReflection)); 4880Writer.WriteLine(";"); 4890Writer.Write("else if (tser == null"); 4891Writer.Write(" || "); 4894Writer.WriteLine(") {"); 4895Writer.Indent++; 4902Writer.Write("ReadSerializable(( "); 4903Writer.Write(typeof(IXmlSerializable).FullName); 4904Writer.Write(")"); 4905Writer.Write(RaCodeGen.GetStringForCreateInstance(derived.TypeDesc!.CSharpName, derived.TypeDesc.UseReflection, derived.TypeDesc.CannotNew, false)); 4908Writer.WriteLine(", true"); 4910Writer.Write(")"); 4912Writer.WriteLine(";"); 4916Writer.Write("throw CreateBadDerivationException("); 4918Writer.Write(", "); 4920Writer.Write(", "); 4922Writer.Write(", "); 4924Writer.Write(", "); 4926Writer.Write(", "); 4928Writer.WriteLine(");"); 4933Writer.WriteLine($"// missing real mapping for {derived.XsiType}"); 4934Writer.Write("throw CreateMissingIXmlSerializableType("); 4936Writer.Write(", "); 4938Writer.Write(", "); 4940Writer.WriteLine(");"); 4943Writer.Indent--; 4944Writer.WriteLine("}"); 4952Writer.WriteLine("Reader.MoveToContent();"); 4953Writer.Write("while (Reader.NodeType != "); 4954Writer.Write(typeof(XmlNodeType).FullName); 4955Writer.Write(".EndElement && Reader.NodeType != "); 4956Writer.Write(typeof(XmlNodeType).FullName); 4957Writer.WriteLine(".None) {"); 4962Writer.Indent--; 4963Writer.WriteLine("}"); 4969Writer.Write(length <= StackallocLimit ? 4972Writer.Write(length.ToString(CultureInfo.InvariantCulture)); 4973Writer.WriteLine("];"); 4978Writer.WriteLine("Reader.MoveToContent();"); 4979Writer.Write("while (Reader.NodeType == "); 4980Writer.Write(typeof(XmlNodeType).FullName); 4981Writer.WriteLine(".Element) {"); 4982Writer.Indent++; 4983Writer.Write("string root = Reader.GetAttribute(\"root\", \""); 4984Writer.Write(Soap.Encoding); 4985Writer.WriteLine("\");"); 4986Writer.Write("if (root == null || "); 4987Writer.Write(typeof(XmlConvert).FullName); 4988Writer.WriteLine(".ToBoolean(root)) break;"); 4989Writer.WriteLine("ReadReferencedElement();"); 4990Writer.WriteLine("Reader.MoveToContent();"); 4996Writer.Write(value ? "true" : "false"); 5001Writer.Write(typeof(ArrayList).FullName); 5002Writer.Write(" "); 5003Writer.Write(source); 5004Writer.Write(" = new "); 5005Writer.Write(typeof(ArrayList).FullName); 5006Writer.WriteLine("();"); 5008Writer.Write(typeof(ArrayList).FullName); 5009Writer.Write(" "); 5010Writer.Write(source); 5011Writer.Write("IsObject = new "); 5012Writer.Write(typeof(ArrayList).FullName); 5013Writer.WriteLine("();"); 5018Writer.WriteLine("int isObjectIndex = 0;"); 5019Writer.Write("foreach (object obj in "); 5020Writer.Write(listSource); 5021Writer.WriteLine(") {"); 5022Writer.Indent++; 5023Writer.WriteLine("bool isReferenced = true;"); 5024Writer.Write("bool isObject = (bool)"); 5025Writer.Write(listSource); 5026Writer.WriteLine("IsObject[isObjectIndex++];"); 5027Writer.WriteLine("object refObj = isObject ? obj : GetTarget((string)obj);"); 5028Writer.WriteLine("if (refObj == null) continue;"); 5029Writer.Write(typeof(Type).FullName); 5030Writer.WriteLine(" refObjType = refObj.GetType();"); 5031Writer.WriteLine("string refObjId = null;"); 5035Writer.WriteLine("if (isObject && isReferenced) Referenced(refObj); // need to mark this obj as ref'd since we didn't do GetTarget"); 5036Writer.Indent--; 5037Writer.WriteLine("}"); 5042Writer.Write("if (Reader.GetAttribute(\"root\", \""); 5043Writer.Write(Soap.Encoding); 5044Writer.WriteLine("\") == \"0\") {"); 5045Writer.Indent++; 5046Writer.WriteLine(source); 5047Writer.Indent--; 5048Writer.WriteLine("}"); 5057Writer.Write(useReflection ? "object" : fullTypeName); 5058Writer.Write(" "); 5059Writer.Write(local); 5060Writer.WriteLine(";"); 5064Writer.WriteLine("try {"); 5065Writer.Indent++; 5067Writer.Write(local); 5068Writer.Write(" = "); 5069Writer.Write(RaCodeGen.GetStringForCreateInstance(fullTypeName, useReflection, mapping.TypeDesc.CannotNew, true)); 5070Writer.WriteLine(";"); 5074Writer.Indent++; 5075Writer.Write("throw CreateInaccessibleConstructorException("); 5077Writer.WriteLine(");"); 5080Writer.Indent++; 5082Writer.Write("throw CreateCtorHasSecurityException("); 5084Writer.WriteLine(");"); 5086Writer.Indent--; 5087Writer.WriteLine("}"); 5093Writer.Indent--; 5094Writer.WriteLine("}"); 5095Writer.Write("catch ("); 5096Writer.Write(exceptionType.FullName); 5097Writer.WriteLine(") {"); 5103Writer.Indent++; 5104Writer.Write("throw CreateInvalidCastException("); 5105Writer.Write(RaCodeGen.GetStringForTypeof(typeDesc.CSharpName, typeDesc.UseReflection)); 5106Writer.Write(", "); 5107Writer.Write(source); 5109Writer.WriteLine(", null);"); 5112Writer.Write(", (string)"); 5113Writer.Write(id); 5114Writer.WriteLine(");"); 5116Writer.Indent--; 5117Writer.WriteLine("}");
System\Xml\Serialization\XmlSerializationWriter.cs (729)
2250Writer.Write(Access); 2251Writer.Write(" class "); 2252Writer.Write(ClassName); 2253Writer.Write(" : "); 2254Writer.Write(typeof(System.Xml.Serialization.XmlSerializationWriter).FullName); 2255Writer.WriteLine(" {"); 2256Writer.Indent++; 2309Writer.Indent--; 2310Writer.WriteLine("}"); 2330Writer.WriteLine(); 2331Writer.WriteLine("protected override void InitCallbacks() {"); 2332Writer.Indent++; 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); 2353Writer.WriteLine("));"); 2358Writer.Indent--; 2359Writer.WriteLine("}"); 2369Writer.WriteLine(" {"); 2370Writer.Indent++; 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(")"); 2393Writer.WriteLine(");"); 2397Writer.Indent--; 2398Writer.WriteLine("}"); 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("("); 2474Writer.WriteLine(" | "); 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(")"); 2489Writer.WriteLine(" {"); 2490Writer.Indent++; 2493Writer.Write(method); 2494Writer.Write("("); 2498Writer.Write(", "); 2502Writer.Write(", "); 2515Writer.Write(", new System.Xml.XmlQualifiedName("); 2517Writer.Write(", "); 2519Writer.Write(")"); 2522Writer.WriteLine(");"); 2526Writer.Indent--; 2527Writer.WriteLine("}"); 2533Writer.Write(methodName); 2534Writer.Write("("); 2536Writer.Write(", "); 2539Writer.Write("null"); 2545Writer.WriteLine(");"); 2550Writer.Write(methodName); 2551Writer.Write("("); 2553Writer.Write(", "); 2556Writer.Write("null"); 2562Writer.Write(", null, "); 2564Writer.Write("true"); 2566Writer.Write("false"); 2567Writer.WriteLine(");"); 2577Writer.WriteLine("WriteEndElement();"); 2581Writer.Write("WriteEndElement("); 2582Writer.Write(source); 2583Writer.WriteLine(");"); 2610Writer.WriteLine(); 2611Writer.Write("public void "); 2612Writer.Write(methodName); 2613Writer.WriteLine("(object[] p) {"); 2614Writer.Indent++; 2616Writer.WriteLine("WriteStartDocument();"); 2620Writer.WriteLine("TopLevelElement();"); 2626Writer.WriteLine("int pLength = p.Length;"); 2637Writer.Write("if (pLength > "); 2638Writer.Write(xmlnsMember.ToString(CultureInfo.InvariantCulture)); 2639Writer.WriteLine(") {"); 2640Writer.Indent++; 2642Writer.Indent--; 2643Writer.WriteLine("}"); 2671Writer.Write("if (pLength > "); 2672Writer.Write(index); 2673Writer.WriteLine(") {"); 2674Writer.Indent++; 2678Writer.Write("if (pLength <= "); 2679Writer.Write(specifiedPosition.ToString(CultureInfo.InvariantCulture)); 2680Writer.Write(" || "); 2681Writer.Write(specifiedSource); 2682Writer.WriteLine(") {"); 2683Writer.Indent++; 2690Writer.Indent--; 2691Writer.WriteLine("}"); 2694Writer.Indent--; 2695Writer.WriteLine("}"); 2726Writer.Write("if (pLength > "); 2727Writer.Write(index); 2728Writer.WriteLine(") {"); 2729Writer.Indent++; 2733Writer.Write("if (pLength <= "); 2734Writer.Write(specifiedPosition.ToString(CultureInfo.InvariantCulture)); 2735Writer.Write(" || "); 2736Writer.Write(specifiedSource); 2737Writer.WriteLine(") {"); 2738Writer.Indent++; 2765Writer.Write("WriteRpcResult("); 2767Writer.Write(", "); 2769Writer.WriteLine(");"); 2777Writer.Indent--; 2778Writer.WriteLine("}"); 2781Writer.Indent--; 2782Writer.WriteLine("}"); 2794Writer.Write("if (pLength > "); 2795Writer.Write(mapping.Members.Length.ToString(CultureInfo.InvariantCulture)); 2796Writer.WriteLine(") {"); 2797Writer.Indent++; 2801Writer.Indent--; 2802Writer.WriteLine("}"); 2804Writer.WriteLine("WriteReferencedElements();"); 2806Writer.Indent--; 2807Writer.WriteLine("}"); 2817Writer.WriteLine(); 2818Writer.Write("public void "); 2819Writer.Write(methodName); 2820Writer.WriteLine("(object o) {"); 2821Writer.Indent++; 2823Writer.WriteLine("WriteStartDocument();"); 2825Writer.WriteLine("if (o == null) {"); 2826Writer.Indent++; 2836Writer.WriteLine("return;"); 2837Writer.Indent--; 2838Writer.WriteLine("}"); 2842Writer.WriteLine("TopLevelElement();"); 2849Writer.WriteLine("WriteReferencedElements();"); 2851Writer.Indent--; 2852Writer.WriteLine("}"); 2864Writer.WriteLine(); 2868Writer.Write("void "); 2869Writer.Write(methodName); 2870Writer.WriteLine("(object e) {"); 2875Writer.Write("string "); 2876Writer.Write(methodName); 2877Writer.Write("("); 2878Writer.Write(mapping.TypeDesc.UseReflection ? "object" : fullTypeName); 2879Writer.WriteLine(" v) {"); 2881Writer.Indent++; 2882Writer.WriteLine("string s = null;"); 2889Writer.WriteLine($"switch ({ReflectionAwareCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection)} ){{"); 2891Writer.WriteLine("switch (v) {"); 2892Writer.Indent++; 2899Writer.Write("s = "); 2901Writer.WriteLine("; break;"); 2909Writer.Write("default: s = FromEnum("); 2910Writer.Write(ReflectionAwareCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection)); 2911Writer.Write(", new string[] {"); 2912Writer.Indent++; 2917Writer.WriteLine(", "); 2920Writer.Write("}, new "); 2921Writer.Write(typeof(long).FullName); 2922Writer.Write("[] {"); 2928Writer.WriteLine(", "); 2929Writer.Write("(long)"); 2931Writer.Write(c.Value.ToString(CultureInfo.InvariantCulture)); 2934Writer.Write(fullTypeName); 2935Writer.Write(".@"); 2937Writer.Write(c.Name); 2940Writer.Indent--; 2941Writer.Write("}, "); 2943Writer.WriteLine("); break;"); 2947Writer.Write("default: throw CreateInvalidEnumValueException("); 2948Writer.Write(ReflectionAwareCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection)); 2949Writer.Write(".ToString(System.Globalization.CultureInfo.InvariantCulture), "); 2951Writer.WriteLine(");"); 2953Writer.Indent--; 2954Writer.WriteLine("}"); 2958Writer.Write("WriteXsiType("); 2960Writer.Write(", "); 2962Writer.WriteLine(");"); 2963Writer.WriteLine("Writer.WriteString(s);"); 2967Writer.WriteLine("return s;"); 2969Writer.Indent--; 2970Writer.WriteLine("}"); 2978Writer.Write("if ("); 2980Writer.WriteLine(") {"); 2981Writer.Indent++; 2990Writer.Write(methodName); 2991Writer.Write("(n, ns,"); 2992if (!derived.TypeDesc.UseReflection) Writer.Write($"({fullTypeName})"); 2993Writer.Write("o"); 2995Writer.Write(", isNullable"); 2996Writer.Write(", true"); 2997Writer.WriteLine(");"); 2998Writer.WriteLine("return;"); 2999Writer.Indent--; 3000Writer.WriteLine("}"); 3017Writer.Write("if ("); 3019Writer.WriteLine(") {"); 3020Writer.Indent++; 3028Writer.WriteLine("Writer.WriteStartElement(n, ns);"); 3029Writer.Write("WriteXsiType("); 3031Writer.Write(", "); 3033Writer.WriteLine(");"); 3034Writer.Write("Writer.WriteString("); 3035Writer.Write(methodName); 3036Writer.Write("("); 3037if (!mapping.TypeDesc.UseReflection) Writer.Write($"({fullTypeName})"); 3038Writer.WriteLine("o));"); 3039Writer.WriteLine("Writer.WriteEndElement();"); 3040Writer.WriteLine("return;"); 3041Writer.Indent--; 3042Writer.WriteLine("}"); 3049Writer.Write("if ("); 3054Writer.WriteLine(") {"); 3055Writer.Indent++; 3057Writer.WriteLine("Writer.WriteStartElement(n, ns);"); 3058Writer.Write("WriteXsiType("); 3060Writer.Write(", "); 3062Writer.WriteLine(");"); 3066Writer.WriteLine("Writer.WriteEndElement();"); 3067Writer.WriteLine("return;"); 3068Writer.Indent--; 3069Writer.WriteLine("}"); 3081Writer.WriteLine(); 3082Writer.Write("void "); 3083Writer.Write(methodName); 3089Writer.WriteLine("(object s) {"); 3090Writer.Indent++; 3095Writer.Write("(string n, string ns, "); 3096Writer.Write(mapping.TypeDesc.UseReflection ? "object" : fullTypeName); 3097Writer.Write(" o"); 3099Writer.Write(", bool isNullable"); 3100Writer.WriteLine(", bool needType) {"); 3101Writer.Indent++; 3104Writer.WriteLine("if ((object)o == null) {"); 3105Writer.Indent++; 3106Writer.WriteLine("if (isNullable) WriteNullTagLiteral(n, ns);"); 3107Writer.WriteLine("return;"); 3108Writer.Indent--; 3109Writer.WriteLine("}"); 3111Writer.WriteLine("if (!needType) {"); 3112Writer.Indent++; 3114Writer.Write(typeof(Type).FullName); 3115Writer.WriteLine(" t = o.GetType();"); 3116Writer.Write("if ("); 3118Writer.WriteLine(") {"); 3119Writer.WriteLine("}"); 3120Writer.WriteLine("else {"); 3121Writer.Indent++; 3128Writer.WriteLine("WriteTypedPrimitive(n, ns, o, true);"); 3129Writer.WriteLine("return;"); 3133Writer.WriteLine("throw CreateUnknownTypeException(o);"); 3135Writer.Indent--; 3136Writer.WriteLine("}"); 3137Writer.Indent--; 3138Writer.WriteLine("}"); 3145Writer.WriteLine("EscapeName = false;"); 3164Writer.Write("WriteStartElement(n, ns, o, false, "); 3166Writer.Write("null"); 3168Writer.Write(xmlnsSource); 3170Writer.WriteLine(");"); 3173Writer.Write("if (needType) WriteXsiType("); 3175Writer.Write(", "); 3177Writer.WriteLine(");"); 3192Writer.Write("if ("); 3195Writer.Write(methodInvoke); 3196Writer.WriteLine(") {"); 3197Writer.Indent++; 3201Writer.Write("if ("); 3204Writer.Write(memberGet); 3205Writer.WriteLine(") {"); 3206Writer.Indent++; 3212Writer.Indent--; 3213Writer.WriteLine("}"); 3217Writer.Indent--; 3218Writer.WriteLine("}"); 3233Writer.Write("if ("); 3236Writer.Write(methodInvoke); 3237Writer.WriteLine(") {"); 3238Writer.Indent++; 3242Writer.Write("if ("); 3245Writer.Write(memberGet); 3246Writer.WriteLine(") {"); 3247Writer.Indent++; 3260Writer.Indent--; 3261Writer.WriteLine("}"); 3265Writer.Indent--; 3266Writer.WriteLine("}"); 3274Writer.Indent--; 3275Writer.WriteLine("}"); 3293Writer.WriteLine("{"); 3294Writer.Indent++; 3299Writer.WriteLine("if (a != null) {"); 3300Writer.Indent++; 3306Writer.Write("Writer.WriteStartAttribute(null, "); 3308Writer.Write(", "); 3316Writer.Write("null"); 3318Writer.WriteLine(");"); 3322Writer.Write(typeof(StringBuilder).FullName); 3323Writer.Write(" sb = new "); 3324Writer.Write(typeof(StringBuilder).FullName); 3325Writer.WriteLine("();"); 3332Writer.Write(" e = "); 3333Writer.Write(typeof(IEnumerator).FullName); 3336Writer.Write("(("); 3337Writer.Write(typeof(IEnumerable).FullName); 3338Writer.WriteLine(").GetEnumerator();"); 3345Writer.Write("("); 3346Writer.Write(typeof(IEnumerator).FullName); 3347Writer.Write(")"); 3348Writer.Write(RaCodeGen.GetReflectionVariable(memberTypeDesc.CSharpName, "System.Collections.Generic.IEnumerable*")); 3349Writer.WriteLine(".Invoke(a, new object[0]);"); 3353Writer.Write("((System.Collections.Generic.IEnumerable<"); 3354Writer.Write(arrayElementTypeDesc.CSharpName); 3355Writer.WriteLine(">)a).GetEnumerator();"); 3362Writer.Write("("); 3363Writer.Write(typeof(IEnumerator).FullName); 3364Writer.Write(")"); 3366Writer.Write(RaCodeGen.GetStringForMethodInvoke("a", memberTypeDesc.CSharpName, "GetEnumerator", memberTypeDesc.UseReflection)); 3367Writer.WriteLine(";"); 3369Writer.WriteLine("if (e != null)"); 3370Writer.WriteLine("while (e.MoveNext()) {"); 3371Writer.Indent++; 3378Writer.Write("for (int i = 0; i < "); 3381Writer.WriteLine("a.Length; i++) {"); 3385Writer.Write("(("); 3386Writer.Write(typeof(ICollection).FullName); 3387Writer.WriteLine(")a).Count; i++) {"); 3389Writer.Indent++; 3398Writer.WriteLine("if (i != 0) Writer.WriteString(\" \");"); 3399Writer.Write("WriteValue("); 3403Writer.WriteLine("if (i != 0) sb.Append(\" \");"); 3404Writer.Write("sb.Append("); 3410Writer.WriteLine(");"); 3416Writer.Indent--; 3417Writer.WriteLine("}"); 3423Writer.WriteLine("Writer.WriteEndAttribute();"); 3427Writer.WriteLine("if (sb.Length != 0) {"); 3428Writer.Indent++; 3430Writer.Write("WriteAttribute("); 3432Writer.Write(", "); 3437Writer.Write(", "); 3439Writer.WriteLine("sb.ToString());"); 3440Writer.Indent--; 3441Writer.WriteLine("}"); 3447Writer.Indent--; 3448Writer.WriteLine("}"); 3450Writer.Indent--; 3451Writer.WriteLine("}"); 3466Writer.Write("WriteXmlAttribute("); 3467Writer.Write(source); 3468Writer.Write(", "); 3469Writer.Write(parent); 3470Writer.WriteLine(");"); 3497Writer.WriteLine("{"); 3498Writer.Indent++; 3503Writer.WriteLine("if (a != null) {"); 3504Writer.Indent++; 3512Writer.WriteLine("if (c == null || c.Length < a.Length) {"); 3513Writer.Indent++; 3514Writer.Write("throw CreateInvalidChoiceIdentifierValueException("); 3516Writer.Write(", "); 3518Writer.Write(");"); 3519Writer.Indent--; 3520Writer.WriteLine("}"); 3526Writer.Indent--; 3527Writer.WriteLine("}"); 3529Writer.Indent--; 3530Writer.WriteLine("}"); 3540Writer.Write(typeof(IEnumerator).FullName); 3541Writer.Write(" e = "); 3544Writer.Write("(("); 3545Writer.Write(typeof(IEnumerable).FullName); 3546Writer.Write(")"); 3547Writer.Write(arrayName); 3548Writer.WriteLine(").GetEnumerator();"); 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); 3561Writer.WriteLine(", new object[0]);"); 3565Writer.Write("((System.Collections.Generic.IEnumerable<"); 3566Writer.Write(arrayElementTypeDesc.CSharpName); 3567Writer.Write(">)"); 3568Writer.Write(arrayName); 3569Writer.WriteLine(").GetEnumerator();"); 3576Writer.Write("("); 3577Writer.Write(typeof(IEnumerator).FullName); 3578Writer.Write(")"); 3580Writer.Write(RaCodeGen.GetStringForMethodInvoke(arrayName, arrayTypeDesc.CSharpName, "GetEnumerator", arrayTypeDesc.UseReflection)); 3581Writer.WriteLine(";"); 3583Writer.WriteLine("if (e != null)"); 3584Writer.WriteLine("while (e.MoveNext()) {"); 3585Writer.Indent++; 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); 3612Writer.WriteLine("++) {"); 3613Writer.Indent++; 3631Writer.Indent--; 3632Writer.WriteLine("}"); 3656Writer.Write("if ((object)("); 3657Writer.Write(source); 3658Writer.Write(") != null)"); 3660Writer.WriteLine("{"); 3661Writer.Indent++; 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)"); 3703Writer.WriteLine(") {"); 3704Writer.Indent++; 3712Writer.Indent--; 3713Writer.WriteLine("}"); 3720if (wroteFirstIf) Writer.Write("else "); 3722Writer.Write("if ("); 3724Writer.WriteLine(") {"); 3725Writer.Indent++; 3730Writer.Indent--; 3731Writer.WriteLine("}"); 3736if (elements.Length - anyCount > 0) Writer.Write("else "); 3740Writer.Write("if ("); 3741Writer.Write(source); 3742Writer.Write(" is "); 3743Writer.Write(fullTypeName); 3744Writer.WriteLine(") {"); 3745Writer.Indent++; 3747Writer.Write(fullTypeName); 3748Writer.Write(" elem = ("); 3749Writer.Write(fullTypeName); 3750Writer.Write(")"); 3751Writer.Write(source); 3752Writer.WriteLine(";"); 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)"); 3776Writer.WriteLine(") {"); 3777Writer.Indent++; 3779Writer.Write("if (elem.Name == "); 3781Writer.Write(" && elem.NamespaceURI == "); 3783Writer.WriteLine(") {"); 3784Writer.Indent++; 3789Writer.Indent--; 3790Writer.WriteLine("}"); 3791Writer.WriteLine("else {"); 3792Writer.Indent++; 3794Writer.WriteLine("// throw Value '{0}' of the choice identifier '{1}' does not match element '{2}' from namespace '{3}'."); 3796Writer.Write("throw CreateChoiceIdentifierValueException("); 3798Writer.Write(", "); 3800Writer.WriteLine(", elem.Name, elem.NamespaceURI);"); 3801Writer.Indent--; 3802Writer.WriteLine("}"); 3804Writer.Indent--; 3805Writer.WriteLine("}"); 3809Writer.WriteLine("else {"); 3810Writer.Indent++; 3818Writer.WriteLine("throw CreateUnknownAnyElementException(elem.Name, elem.NamespaceURI);"); 3822Writer.Indent--; 3823Writer.WriteLine("}"); 3825Writer.Indent--; 3826Writer.WriteLine("}"); 3834Writer.Write("else "); 3835Writer.Write("if ("); 3837Writer.WriteLine(") {"); 3838Writer.Indent++; 3843Writer.Indent--; 3844Writer.WriteLine("}"); 3856Writer.Write("else "); 3860Writer.Write(" if ((object)("); 3861Writer.Write(source); 3862Writer.Write(") != null)"); 3865Writer.WriteLine("{"); 3866Writer.Indent++; 3868Writer.Write("throw CreateUnknownTypeException("); 3869Writer.Write(source); 3870Writer.WriteLine(");"); 3872Writer.Indent--; 3873Writer.WriteLine("}"); 3875Writer.Indent--; 3876Writer.WriteLine("}"); 3884Writer.Write("WriteValue("); 3893Writer.WriteLine(");"); 3900Writer.Write(source); 3901Writer.WriteLine(".WriteTo(Writer);"); 3916Writer.Write("if ("); 3917Writer.Write(source); 3918Writer.WriteLine(" != null) {"); 3919Writer.Indent++; 3927Writer.Indent--; 3928Writer.WriteLine("}"); 3931Writer.WriteLine("else {"); 3932Writer.Indent++; 3934Writer.Indent--; 3935Writer.WriteLine("}"); 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, "); 3959Writer.WriteLine(");"); 3967Writer.WriteLine("{"); 3968Writer.Indent++; 3978Writer.Write("if ("); 3979Writer.Write(elementArrayName); 3980Writer.Write(" != null)"); 3982Writer.WriteLine("{"); 3983Writer.Indent++; 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); 4007Writer.WriteLine("++) {"); 4008Writer.Indent++; 4014Writer.Indent--; 4015Writer.WriteLine("}"); 4017Writer.Indent--; 4018Writer.WriteLine("}"); 4019Writer.Indent--; 4020Writer.WriteLine("}"); 4025Writer.WriteLine("{"); 4026Writer.Indent++; 4036Writer.Write("if ("); 4037Writer.Write(arrayName); 4038Writer.Write(" != null)"); 4040Writer.WriteLine("{"); 4041Writer.Indent++; 4046Writer.Indent--; 4047Writer.WriteLine("}"); 4048Writer.Indent--; 4049Writer.WriteLine("}"); 4057Writer.Write("Writer.WriteStartElement("); 4059Writer.Write(", "); 4061Writer.WriteLine(");"); 4062Writer.Write(methodName); 4063Writer.Write("("); 4064Writer.Write(source); 4065Writer.WriteLine(");"); 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"); 4134Writer.WriteLine(");"); 4145Writer.Write("if (("); 4146Writer.Write(source); 4147Writer.Write(") is "); 4148Writer.Write(typeof(XmlNode).FullName); 4149Writer.Write(" || "); 4150Writer.Write(source); 4151Writer.Write(" == null"); 4152Writer.WriteLine(") {"); 4153Writer.Indent++; 4157Writer.Indent--; 4158Writer.WriteLine("}"); 4159Writer.WriteLine("else {"); 4160Writer.Indent++; 4162Writer.Write("throw CreateInvalidAnyTypeException("); 4163Writer.Write(source); 4164Writer.WriteLine(");"); 4166Writer.Indent--; 4167Writer.WriteLine("}"); 4178Writer.Write(func); 4179Writer.Write("(("); 4180Writer.Write(cast.FullName); 4181Writer.Write(")"); 4182Writer.Write(source); 4183Writer.Write(", "); 4185Writer.Write(", "); 4187Writer.Write(", "); 4189Writer.Write(", "); 4191Writer.WriteLine(");"); 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(", "); 4242Writer.WriteLine(");"); 4247Writer.Write("if ((object)("); 4248Writer.Write(source); 4249Writer.WriteLine(") == null) {"); 4250Writer.Indent++; 4252Writer.Indent--; 4253Writer.WriteLine("}"); 4254Writer.WriteLine("else {"); 4255Writer.Indent++; 4262Writer.Write("null"); 4275Writer.Write('\''); 4278Writer.Write("\'"); 4280Writer.Write(ch); 4281Writer.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); 4387Writer.WriteLine(");"); 4403Writer.Write("for (int i = "); 4404Writer.Write(loopStartSource); 4405Writer.Write("; i < "); 4406Writer.Write(loopEndSource); 4407Writer.WriteLine("; i++) {"); 4408Writer.Indent++; 4409Writer.WriteLine("if (p[i] != null) {"); 4410Writer.Indent++; 4411Writer.WriteLine("WritePotentiallyReferencingElement(null, null, p[i], p[i].GetType(), true, false);"); 4412Writer.Indent--; 4413Writer.WriteLine("}"); 4414Writer.Indent--; 4415Writer.WriteLine("}");