本文整理汇总了C#中IOutputWriter.FirstMatchingTypeFromName方法的典型用法代码示例。如果您正苦于以下问题:C# IOutputWriter.FirstMatchingTypeFromName方法的具体用法?C# IOutputWriter.FirstMatchingTypeFromName怎么用?C# IOutputWriter.FirstMatchingTypeFromName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOutputWriter
的用法示例。
在下文中一共展示了IOutputWriter.FirstMatchingTypeFromName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: resolveTypeFromCache
private bool resolveTypeFromCache(IOutputWriter cache, Dictionary<string, string[]> usingsMap, Dictionary<string, UsingAlias[]> usingAliasesMap, PartialType type)
{
// Cannot do this since expressions might start with System.
//if (type.Type.StartsWith("System."))
// continue;
var typeToMatch = type.Type.Replace("[]", "");
var matchingType = _expression.Resolve(type, typeToMatch);
if (matchingType == null)
matchingType = cache.VariableTypeFromSignature(type.Parent + "." + type.Type);
var usings = getUsings(usingsMap, type);
if (matchingType == null)
{
matchingType = matchToAliases(cache, type.File.File, typeToMatch, usingAliasesMap);
}
if (matchingType == null)
{
matchingType = getMatchingType(cache, typeToMatch, usings);
if (matchingType == null)
matchingType = cache.FirstMatchingTypeFromName(typeToMatch);
}
if (matchingType != null)
type.Resolve(type.Type.Replace(typeToMatch, matchingType));
return matchingType != null;
}
示例2: matchToAliases
private string matchToAliases(IOutputWriter cache, string file, string type, Dictionary<string,UsingAlias[]> usingAliasesMap)
{
UsingAlias[] aliases;
if (!usingAliasesMap.TryGetValue(file, out aliases))
return null;
var match = aliases.FirstOrDefault(x => x.Name == type);
if (match != null) {
if (cache.ContainsType(match.Parent))
return match.Parent;
var firstMatch = cache.FirstMatchingTypeFromName(match.Parent);
if (firstMatch != null)
return firstMatch;
return match.Parent;
}
return null;
}