本文整理汇总了C#中Types.findTypeByName方法的典型用法代码示例。如果您正苦于以下问题:C# Types.findTypeByName方法的具体用法?C# Types.findTypeByName怎么用?C# Types.findTypeByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Types
的用法示例。
在下文中一共展示了Types.findTypeByName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindType
/// <summary>
/// Provides the type associated to the name
/// </summary>
/// <param name="nameSpace">the namespace in which the name should be found</param>
/// <param name="name"></param>
/// <returns></returns>
public Type FindType(Types.NameSpace nameSpace, string name)
{
Type retVal = null;
if (name != null)
{
if (nameSpace != null)
{
if (!_cache.ContainsKey(nameSpace))
{
_cache[nameSpace] = new Dictionary<string, Type>();
}
Dictionary<string, Type> subCache = _cache[nameSpace];
if (!subCache.ContainsKey(name))
{
Type tmp = null;
if (!Utils.Util.isEmpty(name))
{
tmp = nameSpace.findTypeByName(name);
if (tmp == null)
{
if (DefinedTypes.ContainsKey(name))
{
tmp = DefinedTypes[name];
}
}
if (tmp == null && DefinedTypes.ContainsKey("Default." + name))
{
tmp = DefinedTypes["Default." + name];
}
}
subCache[name] = tmp;
}
retVal = subCache[name];
}
else
{
if (DefinedTypes.ContainsKey(name))
{
retVal = DefinedTypes[name];
}
else if (DefinedTypes.ContainsKey("Default." + name))
{
retVal = DefinedTypes["Default." + name];
}
}
}
return retVal;
}
示例2: FindType
/// <summary>
/// Provides the type associated to the name
/// </summary>
/// <param name="nameSpace">the namespace in which the name should be found</param>
/// <param name="name"></param>
/// <returns></returns>
public Type FindType(Types.NameSpace nameSpace, string name)
{
Type retVal = null;
Dictionary<string, Type> definedTypes = DefinedTypes;
if (name != null)
{
if (nameSpace != null)
{
CriticalSection.WaitOne();
try
{
if (!_cache.ContainsKey(nameSpace))
{
_cache[nameSpace] = new Dictionary<string, Type>();
}
Dictionary<string, Type> subCache = _cache[nameSpace];
if (!subCache.ContainsKey(name))
{
Type tmp = null;
if (!Utils.Util.isEmpty(name))
{
tmp = nameSpace.findTypeByName(name);
if (tmp == null)
{
if (definedTypes.ContainsKey(name))
{
tmp = definedTypes[name];
}
}
if (tmp == null && definedTypes.ContainsKey("Default." + name))
{
tmp = definedTypes["Default." + name];
}
}
subCache[name] = tmp;
}
retVal = subCache[name];
}
finally
{
CriticalSection.ReleaseMutex();
}
}
else
{
if (definedTypes.ContainsKey(name))
{
retVal = definedTypes[name];
}
else if (definedTypes.ContainsKey("Default." + name))
{
retVal = definedTypes["Default." + name];
}
}
}
return retVal;
}