IReturnType FixTypeReferenceCasing(TypeReference tr, Location loc)
        {
            if (resolver.CompilationUnit == null)
            {
                return(null);
            }
            if (tr.IsNull)
            {
                return(null);
            }
            IReturnType rt = resolver.SearchType(tr.Type, tr.GenericTypes.Count, loc).Result;

            if (rt != null)
            {
                IClass c = rt.GetUnderlyingClass();
                if (c != null)
                {
                    if (string.Equals(tr.Type, c.Name, StringComparison.InvariantCultureIgnoreCase))
                    {
                        tr.Type = c.Name;
                    }
                }
            }
            return(rt);
        }
        IReturnType FixTypeReferenceCasing(TypeReference tr, Location loc)
        {
            if (resolver.CompilationUnit == null)
            {
                return(null);
            }
            if (tr.IsNull)
            {
                return(null);
            }
            var         searchTypeResult = resolver.SearchType(tr.Type, tr.GenericTypes.Count, loc);
            IReturnType rt = searchTypeResult.Result;

            if (rt != null)
            {
                IClass c = rt.GetUnderlyingClass();
                if (c != null)
                {
                    if (string.Equals(tr.Type, c.Name, StringComparison.OrdinalIgnoreCase))
                    {
                        tr.Type = c.Name;
                    }
                    else if (string.Equals(tr.Type, c.FullyQualifiedName, StringComparison.OrdinalIgnoreCase))
                    {
                        tr.Type = c.FullyQualifiedName;
                    }
                    else if (searchTypeResult.UsedUsing != null && !searchTypeResult.UsedUsing.HasAliases)
                    {
                        tr.Type = c.FullyQualifiedName;
                    }
                }
            }
            foreach (TypeReference arg in tr.GenericTypes)
            {
                FixTypeReferenceCasing(arg, loc);
            }
            return(rt);
        }