internal Member(XmlSerializationReaderCodeGen outerClass, string source, string arraySource, string arrayName, int i, MemberMapping mapping, bool multiRef, string choiceSource)
{
_source = source;
_arrayName = arrayName + "_" + i.ToString(CultureInfo.InvariantCulture);
_choiceArrayName = "choice_" + _arrayName;
_choiceSource = choiceSource;
ElementAccessor[] elements = mapping.Elements;
if (mapping.TypeDesc.IsArrayLike)
{
if (arraySource != null)
_arraySource = arraySource;
else
_arraySource = outerClass.GetArraySource(mapping.TypeDesc, _arrayName, multiRef);
_isArray = mapping.TypeDesc.IsArray;
_isList = !_isArray;
if (mapping.ChoiceIdentifier != null)
{
_choiceArraySource = outerClass.GetArraySource(mapping.TypeDesc, _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) + ");";
_choiceArraySource = init + outerClass.RaCodeGen.GetStringForArrayMember(a, c + "++", mapping.ChoiceIdentifier.Mapping.TypeDesc);
}
else
{
_choiceArraySource = _choiceSource;
}
}
else
{
_arraySource = arraySource == null ? source : arraySource;
_choiceArraySource = _choiceSource;
}
_mapping = mapping;
}