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


C# TypeReference.Implements方法代码示例

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


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

示例1: IsRule

		private bool IsRule (TypeReference type)
		{
			var typeName = type.FullName;
			bool result;
			if (!typeIsRule.TryGetValue (typeName, out result)) {
				result = type.Implements ("Gendarme.Framework.IRule");
				typeIsRule [typeName] = result;
			}
			return result;
		}
开发者ID:boothead,项目名称:mono-tools,代码行数:10,代码来源:ReviewAttributesOnRulesRule.cs

示例2: IsICollection

		static bool IsICollection (TypeReference type)
		{
			if (type.Implements ("System.Collections", "ICollection"))
				return true;

			return type.Implements ("System.Collections.Generic", "ICollection`1");
		}
开发者ID:alfredodev,项目名称:mono-tools,代码行数:7,代码来源:DoNotDeclareSettersOnCollectionPropertiesRule.cs

示例3: InheritsOrImplements

        static string InheritsOrImplements(TypeReference type, string nameSpace, string name)
        {
            if (type.Inherits (nameSpace, name) || type.Implements (nameSpace, name))
                return String.Empty;

            return String.Format (CultureInfo.InvariantCulture,
                "'{0}' should only be used for types that inherits or implements '{1}.{2}'.",
                type.Name, nameSpace, name);
        }
开发者ID:FreeBSD-DotNet,项目名称:mono-tools,代码行数:9,代码来源:UseCorrectSuffixRule.cs

示例4: CheckDictionary

 static string CheckDictionary(TypeReference type)
 {
     if (type.Implements ("System.Collections", "IDictionary") || type.Implements ("System.Collections.Generic", "IDictionary`2"))
         return String.Empty;
     return "'Dictionary' should only be used for types implementing IDictionary and IDictionary<TKey,TValue>.";
 }
开发者ID:FreeBSD-DotNet,项目名称:mono-tools,代码行数:6,代码来源:UseCorrectSuffixRule.cs

示例5: CheckCollection

        static string CheckCollection(TypeReference type)
        {
            if (type.Implements ("System.Collections", "ICollection") ||
                type.Implements ("System.Collections", "IEnumerable") ||
                type.Implements ("System.Collections.Generic", "ICollection`1"))
                return String.Empty;

            if (type.Inherits ("System.Collections", "Queue") || type.Inherits ("System.Collections", "Stack") ||
                type.Inherits ("System.Data", "DataSet") || type.Inherits ("System.Data", "DataTable"))
                return String.Empty;

            return "'Collection' should only be used for implementing ICollection or IEnumerable or inheriting from Queue, Stack, DataSet and DataTable.";
        }
开发者ID:FreeBSD-DotNet,项目名称:mono-tools,代码行数:13,代码来源:UseCorrectSuffixRule.cs

示例6: InheritsOrImplements

		static string InheritsOrImplements (TypeReference type, string subtype)
		{
			if (type.Inherits (subtype) || type.Implements (subtype))
				return String.Empty;
			return String.Format ("'{0}' should only be used for types that inherits or implements {1}.", type.Name, subtype);
		}
开发者ID:nolanlum,项目名称:mono-tools,代码行数:6,代码来源:UseCorrectSuffixRule.cs

示例7: CheckMethod

		public override RuleResult CheckMethod (MethodDefinition method)
		{
			if (!method.HasBody)
				return RuleResult.DoesNotApply;

			//the rule does not apply to the particular case of ToString()
			//that have its own ToStringShouldNotReturnNullRule
			if (!method.HasParameters && method.Name == "ToString")
				return RuleResult.DoesNotApply;

			//only apply to methods returning string, array, or IEnumerable-impl
			return_type = method.ReturnType;
			string_return_type = (return_type.FullName == "System.String");
			array_return_type = return_type.IsArray;
			ienumerable_return_type = return_type.Implements ("System.Collections.IEnumerable");

			if (!string_return_type && !array_return_type && !ienumerable_return_type)
				return RuleResult.DoesNotApply;

			return base.CheckMethod (method);
		}
开发者ID:nolanlum,项目名称:mono-tools,代码行数:21,代码来源:PreferEmptyInstanceOverNullRule.cs


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