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


C# TypeDefinition.IsSubclassOf方法代码示例

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


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

示例1: DoBaseFailed

		private bool DoBaseFailed(TypeDefinition type)
		{
			bool failed = false;
			
			if (type.BaseType != null)
				Log.DebugLine(this, "base name: {0}", type.BaseType.FullName);				

			if (type.IsSubclassOf("System.Attribute", Cache))
				failed = DoCheckSuffix(type, "Attribute");
			
			else if (type.IsSubclassOf("System.EventArgs", Cache))
				failed = DoCheckSuffix(type, "EventArgs");
			
			else if (type.IsSubclassOf("System.Exception", Cache))
				failed = DoCheckSuffix(type, "Exception");
			
			else if (type.IsSubclassOf("System.Collections.Queue", Cache))
				failed = DoCheckSuffix(type, "Collection", "Queue");
			
			else if (type.IsSubclassOf("System.Collections.Stack", Cache))
				failed = DoCheckSuffix(type, "Collection", "Stack");
			
			else if (type.IsSubclassOf("System.Data.DataSet", Cache))
				failed = DoCheckSuffix(type, "DataSet");
			
			else if (type.IsSubclassOf("System.Data.DataTable", Cache))
				failed = DoCheckSuffix(type, "Collection", "DataTable");
			
			else if (type.IsSubclassOf("System.IO.Stream", Cache))
				failed = DoCheckSuffix(type, "Stream");
									
			return failed;
		}
开发者ID:dbremner,项目名称:smokey,代码行数:33,代码来源:SuffixNameRule.cs

示例2: VisitType

		public void VisitType(TypeDefinition type)
		{				
			if (!type.IsAbstract)
			{
				Log.DebugLine(this, "-----------------------------------"); 
				Log.DebugLine(this, "checking {0}", type);				
	
				if (type.BaseType != null)
				{			
					bool passed = !type.IsSubclassOf("System.Attribute", Cache);
	
					for (int i = 0; i < type.CustomAttributes.Count && !passed; ++i)
					{
						string name = type.CustomAttributes[i].Constructor.ToString();
						if (name.Contains("System.AttributeUsageAttribute"))
						{
							passed = true;
						}
					}
					
					if (!passed)
					{
						Log.DebugLine(this, "{0} has no usage attribute", type.Name); 
						Reporter.TypeFailed(type, CheckID, string.Empty);
					}
				}
			}
		}
开发者ID:dbremner,项目名称:smokey,代码行数:28,代码来源:AttributesNeedUsageRule.cs

示例3: VisitType

		public void VisitType(TypeDefinition type)
		{
			if (!type.IsCompilerGenerated())
			{
				if (!type.IsSubclassOf("System.Delegate", Cache) && !type.IsSubclassOf("System.MulticastDelegate", Cache))
				{
					Log.DebugLine(this, "-----------------------------------"); 
					Log.DebugLine(this, "{0:F}", type.FullName);				
		
					if (!type.IsValueType && !type.IsInterface && !type.IsBeforeFieldInit)
					{
						if (type.Name != "<Module>")
							Reporter.TypeFailed(type, CheckID, string.Empty);
					}
				}
			}
		}
开发者ID:dbremner,项目名称:smokey,代码行数:17,代码来源:InlineStaticInitRule.cs

示例4: VisitType

		public void VisitType(TypeDefinition type)
		{						
			Log.DebugLine(this, "-----------------------------------"); 
			Log.DebugLine(this, "checking {0}", type);				

			if (type.IsSubclassOf("System.ApplicationException", Cache))
			{
				Log.DebugLine(this, "descends from ApplicationException"); 
				Reporter.TypeFailed(type, CheckID, string.Empty);
			}
		}
开发者ID:dbremner,项目名称:smokey,代码行数:11,代码来源:CustomExceptionRule.cs

示例5: DoTypeFailed

		private bool DoTypeFailed(TypeDefinition type)
		{
			bool failed = false;
			
			if (DoCheckSuffix(type, "Attribute"))
				failed = !type.IsSubclassOf("System.Attribute", Cache);
				
			else if (DoCheckSuffix(type, "Queue"))
				failed = !type.IsSubclassOf("System.Collections.Queue", Cache);

			else if (DoCheckSuffix(type, "Dictionary"))
				failed = !type.TypeOrBaseImplements("System.Collections.IDictionary", Cache);

			else if (DoCheckSuffix(type, "Stack"))
				failed = !type.IsSubclassOf("System.Collections.Stack", Cache);				

			else if (DoCheckSuffix(type, "Collection"))
				failed = !type.IsSubclassOf("System.Collections.Queue", Cache) &&
					!type.IsSubclassOf("System.Collections.Stack", Cache) &&
					!type.IsSubclassOf("System.Data.DataSet", Cache) &&
					!type.IsSubclassOf("System.Data.DataTable", Cache) &&
					!type.TypeOrBaseImplements("System.Collections.ICollection", Cache) &&
					!type.TypeOrBaseImplements("System.Collections.IEnumerable", Cache) &&
					!type.TypeOrBaseImplements("System.Collections.Generic.ICollection", Cache);
				
			else if (DoCheckSuffix(type, "EventArgs"))
				failed = !type.IsSubclassOf("System.EventArgs", Cache);
				
			else if (DoCheckSuffix(type, "Exception"))
				failed = !type.IsSubclassOf("System.Exception", Cache);
				
			else if (DoCheckSuffix(type, "Stream"))
				failed = !type.IsSubclassOf("System.IO.Stream", Cache);				
													
			else if (DoCheckSuffix(type, "Permission"))
				failed = !type.TypeOrBaseImplements("System.Security.IPermission", Cache);

			return failed;
		}
开发者ID:dbremner,项目名称:smokey,代码行数:39,代码来源:SuffixName2Rule.cs

示例6: VisitType

		public void VisitType(TypeDefinition type)
		{
			if (type.BaseType != null && type.IsSubclassOf("System.Attribute", Cache))
			{			
				Log.DebugLine(this, "-----------------------------------"); 
				Log.DebugLine(this, "checking {0}", type);		
				
				if (!type.IsSealed && !type.IsAbstract)
				{
					if (type.ExternallyVisible(Cache))
					{
						Log.DebugLine(this, "{0} has no usage attribute", type.Name); 
						Reporter.TypeFailed(type, CheckID, string.Empty);
					}
				}
			}
		}
开发者ID:dbremner,项目名称:smokey,代码行数:17,代码来源:UnsealedAttributeRule.cs

示例7: VisitType

		public void VisitType(TypeDefinition type)
		{
			if (type.IsSubclassOf("System.Exception", Cache))
			{
				Log.DebugLine(this, "-----------------------------------"); 
				Log.DebugLine(this, "{0}", type);
				
				if (DoHasNonStaticField(type.Fields))
				{
					MethodDefinition[] methods = type.Methods.GetMethod("GetObjectData"); 
					if (methods == null || methods.Length == 0)
					{
						Log.DebugLine(this, "no GetObjectData"); 
						Reporter.TypeFailed(type, CheckID, string.Empty);
					}
				}
			}
		}
开发者ID:dbremner,项目名称:smokey,代码行数:18,代码来源:SerializeExceptionMembersRule.cs

示例8: DoSuffixFailed

		private bool DoSuffixFailed(TypeDefinition type)
		{
			bool failed = false;
			
			if (DoCheckSuffix(type, "Delegate"))
				failed = true;
				
			else if (DoCheckSuffix(type, "Enum"))
				failed = true;
				
			else if (DoCheckSuffix(type, "Flags"))
				failed = type.IsSubclassOf("System.Enum", Cache);
				
			else if (DoCheckSuffix(type, "Impl"))
				failed = true;

			return failed;
		}
开发者ID:dbremner,项目名称:smokey,代码行数:18,代码来源:SuffixName3Rule.cs

示例9: DoValidType

		private bool DoValidType(TypeDefinition type)
		{
			if (type.IsEnum)
			{
				Log.DebugLine(this, "   enum");
				return false;
			}
			else if (type.IsAbstract)
			{
				Log.DebugLine(this, "   abstract");
				return false;
			}
			else if (type.IsSubclassOf("System.Delegate", Cache) || type.IsSubclassOf("System.MulticastDelegate", Cache))
			{
				Log.DebugLine(this, "   delegate");
				return false;
			}	
			else if (type.IsSubclassOf("System.Attribute", Cache))
			{
				Log.DebugLine(this, "   attribute");
				return false;
			}	
			else if (DoAnyDisablesRule(type))
			{
				Log.DebugLine(this, "   disabled");
				return false;
			}	
			else if (type.CustomAttributes.Has("CompilerGeneratedAttribute"))
			{
				Log.DebugLine(this, "   compiler generated");
				return false;
			}
				
//			foreach (MethodDefinition method in type.Methods)
//			{
//				if (!method.IsStatic)
//				{
					Log.DebugLine(this, "   valid type");
//					return true;
//				}
//			}

			return true;
		}
开发者ID:dbremner,项目名称:smokey,代码行数:44,代码来源:NotInstantiatedRule.cs

示例10: MightNeedFix

 bool MightNeedFix(TypeDefinition type)
 {
     return !type.IsAbstract && type.IsSubclassOf ("Java.Lang.Object");
 }
开发者ID:yudhitech,项目名称:xamarin-android,代码行数:4,代码来源:FixAbstractMethodsStep.cs


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