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


C# Method.GetAttribute方法代码示例

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


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

示例1: IsAnnotated

    public static bool IsAnnotated(Method m) {
      bool res = m.GetAttribute(SystemTypes.WriteAttribute) != null;
      res = res || m.GetAttribute(SystemTypes.WriteConfinedAttribute) != null;
      res = res || m.GetAttribute(SystemTypes.GlobalWriteAttribute) != null;
      res = res || m.GetAttribute(SystemTypes.GlobalReadAttribute) != null;
      res = res || m.GetAttribute(SystemTypes.PureAttribute) != null;
      if (m.Parameters != null) {
        foreach (Parameter p in m.Parameters) {
          res = res || p.GetAttribute(SystemTypes.ReadAttribute) != null;
          res = res || p.GetAttribute(SystemTypes.PureAttribute) != null;
          res = res || p.GetAttribute(SystemTypes.WriteAttribute) != null;
          res = res || p.GetAttribute(SystemTypes.WriteConfinedAttribute) != null;
          res = res || p.GetAttribute(SystemTypes.EscapesAttribute) != null;
          }
        }


      return res;
      }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:19,代码来源:PointsToAndEffectsAnnotations.cs

示例2: IsDeclaredWrite

    public static bool IsDeclaredWrite(Method m) {
      if (WorstCase)
        return true;
      bool res = true;
      AttributeNode attr = m.GetAttribute(SystemTypes.WriteAttribute);
      if (attr != null) {
        WriteAttribute wAttr = (WriteAttribute)attr.GetRuntimeAttribute();
        res = wAttr.Value;
        }
      else
        res = true;

      return res;
      }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:14,代码来源:PointsToAndEffectsAnnotations.cs

示例3: IsEscaping

    public static bool IsEscaping(Method m, out bool owned) {
      if (WorstCase) {
        owned = true;
        return true;
        }

      bool res = false;
      owned = false;
      if (!m.IsStatic) {
        if (m.GetAttribute(SystemTypes.CapturedAttribute) != null) {
          owned = true;
          return true;
          }
        }
      AttributeNode attr = m.GetAttribute(SystemTypes.EscapesAttribute);
      if (attr != null) {
        EscapesAttribute escAttr = (EscapesAttribute)attr.GetRuntimeAttribute();
        if (escAttr != null) {
          res = escAttr.Value;
          owned = escAttr.Owned;
          }
        }
      return res && !IsConstructor(m);
      }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:24,代码来源:PointsToAndEffectsAnnotations.cs

示例4: IsDeclaredFresh

    public static bool IsDeclaredFresh(Method m) {
      if (WorstCase)
        return false;

      bool res = false;
      res = m.GetAttribute(SystemTypes.FreshAttribute) != null;
      if (m.ReturnAttributes != null && m.ReturnAttributes.Count != 0) {
        foreach (AttributeNode attr in m.ReturnAttributes) {
          res = res || attr.Type.Equals(SystemTypes.FreshAttribute);
          }
        }
      return res;
      }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:13,代码来源:PointsToAndEffectsAnnotations.cs

示例5: IsDeclaredAccessingGlobals

    public static bool IsDeclaredAccessingGlobals(Method m) {
      if (WorstCase)
        return true;

      bool res = true;


      AttributeNode attr = m.GetAttribute(SystemTypes.GlobalAccessAttribute);
      if (attr != null) {
        GlobalAccessAttribute readAttr = (GlobalAccessAttribute)attr.GetRuntimeAttribute();
        if (readAttr != null)
          res = readAttr.Value;
        }
      else {
        if (IsAssumedConfinedMethod(m))
          return false;

        // We assume thet constructor are not writing globals
        if (CciHelper.IsConstructor(m))
          res = false;

        //if (m.DeclaringType != null && CciHelper.IsInterface(m.DeclaringType) 
        //    && m.DeclaringType.FullName.StartsWith("System.Collections"))
        //    return false;
        }
      return res;
      }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:27,代码来源:PointsToAndEffectsAnnotations.cs

示例6: IsDeclaredWritingGlobals

    public static bool IsDeclaredWritingGlobals(Method m) {
      if (WorstCase)
        return true;

      bool res = false;

      AttributeNode attr = m.GetAttribute(SystemTypes.GlobalWriteAttribute);
      if (attr != null) {
        GlobalWriteAttribute writeAttr = (GlobalWriteAttribute)attr.GetRuntimeAttribute();
        if (writeAttr != null)
          res = writeAttr.Value;
        }
      else {

        if (!IsDeclaredAccessingGlobals(m))
          return false;
        if (IsAssumedPureMethod(m)
            || IsDeclaredWriteConfined(m))
          return false;
        }
      return res;
      }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:22,代码来源:PointsToAndEffectsAnnotations.cs

示例7: IsPurityForcedByUser

    public static bool IsPurityForcedByUser(Method method) {
      if (WorstCase)
        return false;
      bool res = false;
      AttributeNode attr = method.GetAttribute(SystemTypes.PureAttribute);
      if (attr != null) {
        PureAttribute purity = (PureAttribute)attr.GetRuntimeAttribute();
        if (purity != null)
          return purity.IsAssumedPure;
        }

      return res;

      }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:14,代码来源:PointsToAndEffectsAnnotations.cs

示例8: IsModelUseOk

 //invariants can only use confined and state independent functions
 public virtual bool IsModelUseOk(Member member, Method method) {
   if (member == null || method == null) return true;
   if (member is ParameterField) return true;
   if (member is Field) return true;
   return (member.GetAttribute(SystemTypes.ModelAttribute)!= null) ? method.GetAttribute(SystemTypes.ModelAttribute)!= null: true;
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:7,代码来源:Checker.cs


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