當前位置: 首頁>>代碼示例>>C#>>正文


C# TypeReference.Inherits方法代碼示例

本文整理匯總了C#中Mono.Cecil.TypeReference.Inherits方法的典型用法代碼示例。如果您正苦於以下問題:C# TypeReference.Inherits方法的具體用法?C# TypeReference.Inherits怎麽用?C# TypeReference.Inherits使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mono.Cecil.TypeReference的用法示例。


在下文中一共展示了TypeReference.Inherits方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: IsSpecialCase

		static bool IsSpecialCase (TypeReference type)
		{
			return type.Inherits ("System.Security", "PermissionSet");
		}
開發者ID:alfredodev,項目名稱:mono-tools,代碼行數:4,代碼來源:DoNotDeclareSettersOnCollectionPropertiesRule.cs

示例2: CheckCallingBaseMethod

        private void CheckCallingBaseMethod(TypeReference type, MethodSignature methodSignature)
        {
            MethodDefinition method = type.GetMethod (methodSignature);
            if (method == null)
                return; // Perhaps should report that doesn't exist the method (only with ctor).

            // is there any Call or Callvirt instructions in the method
            if (OpCodeBitmask.Calls.Intersect (OpCodeEngine.GetBitmask (method))) {
                // in this case we check further
                foreach (Instruction instruction in method.Body.Instructions) {
                    if (instruction.OpCode.FlowControl != FlowControl.Call)
                        continue;

                    MethodReference operand = (MethodReference) instruction.Operand;
                    TypeReference tr = operand.DeclaringType;
                    if (methodSignature.Matches (operand) && type.Inherits (tr.Namespace, tr.Name))
                        return;
                }
            }

            Runner.Report (method, Severity.High, Confidence.High);
        }
開發者ID:alfredodev,項目名稱:mono-tools,代碼行數:22,代碼來源:CallBaseMethodsOnISerializableTypesRule.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: 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

示例5: 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

示例6: InheritFromWeakType

		static string InheritFromWeakType (TypeReference type, string nameSpace, string name)
		{
			if (!type.Inherits (nameSpace, name))
				return String.Empty;
			return String.Format (CultureInfo.InvariantCulture, "'{0}' inherits from '{1}.{2}'.", 
				type.GetFullName (), nameSpace, name);
		}
開發者ID:FreeBSD-DotNet,項目名稱:mono-tools,代碼行數:7,代碼來源:DoNotLockOnWeakIdentityObjectsRule.cs


注:本文中的Mono.Cecil.TypeReference.Inherits方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。