private void WriteCollectionInfo(string typeVariable, TypeDesc typeDesc, Type type)
{
string typeFullName = CodeIdentifier.GetCSharpName(type);
string elementTypeFullName = typeDesc.ArrayElementTypeDesc.CSharpName;
bool elementUseReflection = typeDesc.ArrayElementTypeDesc.UseReflection;
if (typeDesc.IsCollection)
{
WriteDefaultIndexerInit(type, typeFullName, typeDesc.UseReflection, elementUseReflection);
}
else if (typeDesc.IsEnumerable)
{
if (typeDesc.IsGenericInterface)
{
WriteMethodInfo(typeFullName, typeVariable, "System.Collections.Generic.IEnumerable*", true);
}
else if (!typeDesc.IsPrivateImplementation)
{
WriteMethodInfo(typeFullName, typeVariable, "GetEnumerator", true);
}
}
WriteMethodInfo(typeFullName, typeVariable, "Add", false, GetStringForTypeof(elementTypeFullName, elementUseReflection));
}