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


C# IClass.IsTypeInInheritanceTree方法代码示例

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


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

示例1: BaseClassIsFormOrControl

		public static bool BaseClassIsFormOrControl(IClass c)
		{
			// Simple test for fully qualified name
			c = c.GetCompoundClass();
			foreach (IReturnType baseType in c.BaseTypes) {
				if (baseType.FullyQualifiedName == "System.Windows.Forms.Form"
				    || baseType.FullyQualifiedName == "System.Windows.Forms.UserControl"
				    // also accept Form and UserControl when they could not be resolved
				    || baseType.FullyQualifiedName == "Form"
				    || baseType.FullyQualifiedName == "UserControl")
				{
					return true;
				}
			}
			
			IClass form = c.ProjectContent.GetClass("System.Windows.Forms.Form", 0);
			IClass userControl = c.ProjectContent.GetClass("System.Windows.Forms.UserControl", 0);
			if (form != null && c.IsTypeInInheritanceTree(form))
				return true;
			if (userControl != null && c.IsTypeInInheritanceTree(userControl))
				return true;
			return false;
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:23,代码来源:SecondaryDisplayBinding.cs

示例2: IsAccessible

		public bool IsAccessible(IClass callingClass, bool isAccessThoughReferenceOfCurrentClass)
		{
			if (IsPublic) {
				return true;
			} else if (IsInternal) {
				// members can be both internal and protected: in that case, we want to return true if it is visible
				// through any of the modifiers
				if (callingClass != null && this.DeclaringType.ProjectContent.InternalsVisibleTo(callingClass.ProjectContent))
					return true;
			}
			// protected or private:
			// search in callingClass and, if callingClass is a nested class, in its outer classes
			while (callingClass != null) {
				if (IsProtected) {
					if (!isAccessThoughReferenceOfCurrentClass && !IsStatic)
						return false;
					return callingClass.IsTypeInInheritanceTree(this.DeclaringType);
				} else {
					// private
					if (DeclaringType.FullyQualifiedName == callingClass.FullyQualifiedName
					    && DeclaringType.TypeParameters.Count == callingClass.TypeParameters.Count)
					{
						return true;
					}
				}
				
				callingClass = callingClass.DeclaringType;
			}
			return false;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:30,代码来源:AbstractEntity.cs

示例3: GetAccessibleTypes

		public List<IClass> GetAccessibleTypes(IClass callingClass)
		{
			List<IClass> types = new List<IClass>();
			List<IClass> visitedTypes = new List<IClass>();
			
			IClass currentClass = this;
			do {
				if (visitedTypes.Contains(currentClass))
					break;
				visitedTypes.Add(currentClass);
				bool isClassInInheritanceTree = callingClass != null ? callingClass.IsTypeInInheritanceTree(currentClass) : false;
				foreach (IClass c in currentClass.InnerClasses) {
					if (c.IsAccessible(callingClass, isClassInInheritanceTree)) {
						types.Add(c);
					}
				}
				currentClass = currentClass.BaseClass;
			} while (currentClass != null);
			return types;
		}
开发者ID:XQuantumForceX,项目名称:Reflexil,代码行数:20,代码来源:DefaultClass.cs


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