GetArraySource() private method

private GetArraySource ( TypeDesc typeDesc, string arrayName ) : string
typeDesc TypeDesc
arrayName string
return string
            internal Member(XmlSerializationReaderCodeGen outerClass, string source, string arraySource, string arrayName, int i, MemberMapping mapping, bool multiRef, string choiceSource) {
                this.source = source;
                this.arrayName = arrayName + "_" + i.ToString(CultureInfo.InvariantCulture);
                this.choiceArrayName = "choice_" + this.arrayName;
                this.choiceSource = choiceSource;
                ElementAccessor[] elements = mapping.Elements;

                if (mapping.TypeDesc.IsArrayLike) {
                    if (arraySource != null)
                        this.arraySource = arraySource;
                    else
                        this.arraySource = outerClass.GetArraySource(mapping.TypeDesc, this.arrayName, multiRef);
                    isArray = mapping.TypeDesc.IsArray;
                    isList = !isArray;
                    if (mapping.ChoiceIdentifier != null) {
                        this.choiceArraySource = outerClass.GetArraySource(mapping.TypeDesc, this.choiceArrayName, multiRef);

                        string a = choiceArrayName;
                        string c = "c" + a;
                        bool choiceUseReflection = mapping.ChoiceIdentifier.Mapping.TypeDesc.UseReflection;
                        string choiceTypeFullName = mapping.ChoiceIdentifier.Mapping.TypeDesc.CSharpName;
                        string castString = choiceUseReflection?"":"(" + choiceTypeFullName + "[])";
                        
                        string init = a + " = " + castString +
                            "EnsureArrayIndex(" + a + ", " + c + ", " + outerClass.RaCodeGen.GetStringForTypeof(choiceTypeFullName, choiceUseReflection) + ");";
                        this.choiceArraySource = init + outerClass.RaCodeGen.GetStringForArrayMember(a,  c + "++", mapping.ChoiceIdentifier.Mapping.TypeDesc);
                    }
                    else {
                        this.choiceArraySource = this.choiceSource;
                    }
                }
                else {
                    this.arraySource = arraySource == null ? source : arraySource;
                    this.choiceArraySource = this.choiceSource;
                }
                this.mapping = mapping;
            }
 internal Member(XmlSerializationReaderCodeGen outerClass, string source, string arraySource, string arrayName, int i, MemberMapping mapping, bool multiRef, string choiceSource)
 {
     this.fixupIndex = -1;
     this.source = source;
     this.arrayName = arrayName + "_" + i.ToString(CultureInfo.InvariantCulture);
     this.choiceArrayName = "choice_" + this.arrayName;
     this.choiceSource = choiceSource;
     ElementAccessor[] elements = mapping.Elements;
     if (mapping.TypeDesc.IsArrayLike)
     {
         if (arraySource != null)
         {
             this.arraySource = arraySource;
         }
         else
         {
             this.arraySource = outerClass.GetArraySource(mapping.TypeDesc, this.arrayName, multiRef);
         }
         this.isArray = mapping.TypeDesc.IsArray;
         this.isList = !this.isArray;
         if (mapping.ChoiceIdentifier != null)
         {
             this.choiceArraySource = outerClass.GetArraySource(mapping.TypeDesc, this.choiceArrayName, multiRef);
             string choiceArrayName = this.choiceArrayName;
             string str2 = "c" + choiceArrayName;
             bool useReflection = mapping.ChoiceIdentifier.Mapping.TypeDesc.UseReflection;
             string cSharpName = mapping.ChoiceIdentifier.Mapping.TypeDesc.CSharpName;
             string str4 = useReflection ? "" : ("(" + cSharpName + "[])");
             string str5 = choiceArrayName + " = " + str4 + "EnsureArrayIndex(" + choiceArrayName + ", " + str2 + ", " + outerClass.RaCodeGen.GetStringForTypeof(cSharpName, useReflection) + ");";
             this.choiceArraySource = str5 + outerClass.RaCodeGen.GetStringForArrayMember(choiceArrayName, str2 + "++", mapping.ChoiceIdentifier.Mapping.TypeDesc);
         }
         else
         {
             this.choiceArraySource = this.choiceSource;
         }
     }
     else
     {
         this.arraySource = (arraySource == null) ? source : arraySource;
         this.choiceArraySource = this.choiceSource;
     }
     this.mapping = mapping;
 }