当前位置: 首页>>代码示例>>C#>>正文


C# IType.GetTypeDepth方法代码示例

本文整理汇总了C#中IType.GetTypeDepth方法的典型用法代码示例。如果您正苦于以下问题:C# IType.GetTypeDepth方法的具体用法?C# IType.GetTypeDepth怎么用?C# IType.GetTypeDepth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IType的用法示例。


在下文中一共展示了IType.GetTypeDepth方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetLogicalTypeDepth

 public int GetLogicalTypeDepth(IType type)
 {
     int depth = type.GetTypeDepth();
     if (type.IsValueType) return depth - 1;
     return depth;
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:6,代码来源:CallableResolutionService.cs

示例2: GetMostGenericType

		public IType GetMostGenericType(IType current, IType candidate)
		{
			if (null == current && null == candidate)
				throw new ArgumentNullException("current", "Both 'current' and 'candidate' are null");

			if (null == current)
				return candidate;

			if (null == candidate)
				return current;

			if (IsAssignableFrom(current, candidate))
				return current;

			if (IsAssignableFrom(candidate, current))
				return candidate;

			if (IsNumberOrBool(current) && IsNumberOrBool(candidate))
				return GetPromotedNumberType(current, candidate);

			if (IsCallableType(current) && IsCallableType(candidate))
				return ICallableType;

			if (current.IsClass && candidate.IsClass)
			{
				if (current == ObjectType || candidate == ObjectType)
					return ObjectType;

				if (current.GetTypeDepth() < candidate.GetTypeDepth())
					return GetMostGenericType(current.BaseType, candidate);

				return GetMostGenericType(current, candidate.BaseType);
			}
			return ObjectType;
		}
开发者ID:HaKDMoDz,项目名称:GNet,代码行数:35,代码来源:TypeSystemServices.cs

示例3: GetMostGenericType

        public IType GetMostGenericType(IType current, IType candidate)
        {
            if (current.IsAssignableFrom(candidate))
            {
                return current;
            }

            if (candidate.IsAssignableFrom(current))
            {
                return candidate;
            }

            if (IsNumberOrBool(current) && IsNumberOrBool(candidate))
            {
                return GetPromotedNumberType(current, candidate);
            }

            if (IsCallableType(current) && IsCallableType(candidate))
            {
                return ICallableType;
            }

            if (current.IsClass && candidate.IsClass)
            {
                if (current ==  ObjectType || candidate == ObjectType)
                {
                    return ObjectType;
                }
                if (current.GetTypeDepth() < candidate.GetTypeDepth())
                {
                    return GetMostGenericType(current.BaseType, candidate);
                }
                return GetMostGenericType(current, candidate.BaseType);
            }
            return ObjectType;
        }
开发者ID:boo,项目名称:boo-lang,代码行数:36,代码来源:TypeSystemServices.cs


注:本文中的IType.GetTypeDepth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。