System.Xml.Serialization.ReflectionAwareCodeGen.WriteArrayLocalDecl C# (CSharp) Method

WriteArrayLocalDecl() private method

private WriteArrayLocalDecl ( string typeName, string variableName, string initValue, TypeDesc arrayTypeDesc ) : void
typeName string
variableName string
initValue string
arrayTypeDesc TypeDesc
return void
        internal void WriteArrayLocalDecl(string typeName, string variableName, string initValue, TypeDesc arrayTypeDesc)
        {
            if (arrayTypeDesc.UseReflection)
            {
                if (arrayTypeDesc.IsEnumerable)
                    typeName = typeof(IEnumerable).FullName;
                else if (arrayTypeDesc.IsCollection)
                    typeName = typeof(ICollection).FullName;
                else
                    typeName = typeof(Array).FullName;
            }
            _writer.Write(typeName);
            _writer.Write(" ");
            _writer.Write(variableName);
            if (initValue != null)
            {
                _writer.Write(" = ");
                if (initValue != "null")
                    _writer.Write("(" + typeName + ")");
                _writer.Write(initValue);
            }
            _writer.WriteLine(";");
        }
        internal void WriteEnumCase(string fullTypeName, ConstantMapping c, bool useReflection)