private string GetFriendlyGenericName(TypeReference typeReference)
        {
            string name = typeReference.GetFriendlyTypeName(null);
            if (name.Contains("<"))
            {
                name = name.Substring(0, name.IndexOf('<'));
			}
            return name;
        }
        private string GetNameByType(TypeReference typeReference)
        {
            TypeDefinition typeDef = typeReference.Resolve();
            if (typeDef != null && typeDef.HasCompilerGeneratedAttribute())
            {
                return "variable";
            }

            if (ShouldBePluralized(typeReference))
            {
				if (typeReference.IsGenericInstance)
                {
                    GenericInstanceType genericInstance = (GenericInstanceType)typeReference;

                    TypeReference variableType = genericInstance.GenericArguments[0];
                    //TypeReference variableType;
                    if (genericInstance.PostionToArgument.ContainsKey(0))
                    {
                        variableType = genericInstance.PostionToArgument[0];
                    }
                    typeDef = variableType.Resolve();
                    if (typeDef != null && typeDef.HasCompilerGeneratedAttribute())
                    {
                        return "collection";
                    }

					string name = GetFriendlyGenericName(variableType);
                    return Camelize(name, Conversion.Plural);
                }
				else if (typeReference.GenericParameters.Count != 0) // cover TypeDefinitions of generic types.
                {
                    string name = GetFriendlyGenericName(typeReference);
                    return Camelize(name, Conversion.Singular);
                }
                else
				{
					string name = typeReference.GetFriendlyTypeName(null);
					return Camelize(name, Conversion.Plural);
				}
            }
            return GetFriendlyNameByType(typeReference);
        }