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


C# Member.GetAttribute方法代码示例

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


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

示例1: IsSpecProtected

 private bool IsSpecProtected(Member member) {
   return member.GetAttribute(SystemTypes.SpecProtectedAttribute)!= null &&
     this.GetTypeView(this.currentType).IsAssignableTo(member.DeclaringType) && 
     this.currentType.NodeType==NodeType.Class && member.DeclaringType.NodeType==NodeType.Class;
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:5,代码来源:Checker.cs

示例2: IsSpecInternal

 private bool IsSpecInternal(Member member) {
   return member.GetAttribute(SystemTypes.SpecInternalAttribute)!= null &&
     this.currentType.DeclaringModule == member.DeclaringType.DeclaringModule;
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:4,代码来源:Checker.cs

示例3: switch

    /*
     *  if (member == null || method == null) return false;
      if (member is ParameterField) return true;
      if (method.Flags == MethodFlags.CompilerControlled) return true; // comprehension, but what else?
      switch ((((Method)method).Flags & MethodFlags.MethodAccessMask)){
        case MethodFlags.Public:
          return member.IsPublic || 
            member.GetAttribute(SystemTypes.SpecPublicAttribute)!= null;
        case MethodFlags.Family:
          return member.IsPublic || member.IsFamily || 
            member.GetAttribute(SystemTypes.SpecPublicAttribute)!= null  || member.GetAttribute(SystemTypes.SpecProtectedAttribute)!= null;
        case MethodFlags.Assembly:
          return member.IsPublic || member.IsAssembly || 
            member.GetAttribute(SystemTypes.SpecPublicAttribute)!= null  || member.GetAttribute(SystemTypes.SpecInternalAttribute)!= null; 
        case MethodFlags.FamANDAssem:
          return member.IsPublic || member.IsFamilyAndAssembly ||
            member.GetAttribute(SystemTypes.SpecPublicAttribute)!=null  || 
            (member.GetAttribute(SystemTypes.SpecInternalAttribute)!=null && member.GetAttribute(SystemTypes.SpecProtectedAttribute) != null);
        case MethodFlags.FamORAssem:
          return member.IsPublic || member.IsFamily || member.IsFamilyOrAssembly || member.IsAssembly ||
            member.GetAttribute(SystemTypes.SpecPublicAttribute)!=null  || member.GetAttribute(SystemTypes.SpecInternalAttribute)!=null ||
            member.GetAttribute(SystemTypes.SpecProtectedAttribute)!=null  
            ;
        case MethodFlags.Private:
          return true;
     */

    private bool IsSpecPublic(Member member) {
      return member.GetAttribute(SystemTypes.SpecPublicAttribute)!= null;
    }
开发者ID:hesam,项目名称:SketchSharp,代码行数:30,代码来源:Checker.cs

示例4: AsAccessible

 //member as accesible as the method in which it is used -- used for contracts
 public virtual bool AsAccessible(Member member, Method method) {
   if (member == null || method == null) return false;
   if (member is ParameterField) return true;
   if (method.Flags == MethodFlags.CompilerControlled) return true; // comprehension, but what else?
   if (this.insideModifies) {
     // no restrictions on what can be referred to within a modifies clause, at least
     // not in terms of visibility.
     return true;
   }
   // Relaxing the rules: for postconditions allow anything that all implementations of the
   // method have access to.
   if (this.insideEnsures) {
     // if this method is the only implementation, it can see everything
     if (!method.IsVirtual || method.DeclaringType.IsSealed || method.IsFinal)
       return true;
     // virtual methods can have other implementations in subtypes.
     // Private fields are not allowed.
     // Internal fields (that are not *also* protected) are allowed only if the method
     // is not visible outside of the assembly.
     // Everything else is allowed.
     if (member.GetAttribute(SystemTypes.SpecPublicAttribute)== null
       &&
       (member.IsPrivate || (member.IsAssembly && !member.IsFamily && method.IsVisibleOutsideAssembly)))
       return false;
     return true;
   }
   switch ((((Method)method).Flags & MethodFlags.MethodAccessMask)) {
     case MethodFlags.Public:
       return member.IsPublic || 
         member.GetAttribute(SystemTypes.SpecPublicAttribute)!= null;
     case MethodFlags.Family:
       return member.IsPublic || member.IsFamily || member.IsFamilyOrAssembly ||
         member.GetAttribute(SystemTypes.SpecPublicAttribute)!= null  || member.GetAttribute(SystemTypes.SpecProtectedAttribute)!= null;
     case MethodFlags.Assembly:
       return member.IsPublic || member.IsAssembly || member.IsFamilyOrAssembly ||
         member.GetAttribute(SystemTypes.SpecPublicAttribute)!= null  || member.GetAttribute(SystemTypes.SpecInternalAttribute)!= null;
     case MethodFlags.FamANDAssem:
       return member.IsPublic || member.IsFamilyAndAssembly ||
         member.GetAttribute(SystemTypes.SpecPublicAttribute)!=null  || 
         (member.GetAttribute(SystemTypes.SpecInternalAttribute)!=null && member.GetAttribute(SystemTypes.SpecProtectedAttribute) != null);
     case MethodFlags.FamORAssem:
       return member.IsPublic || member.IsFamily || member.IsFamilyOrAssembly || member.IsAssembly ||
         member.GetAttribute(SystemTypes.SpecPublicAttribute)!=null  || member.GetAttribute(SystemTypes.SpecInternalAttribute)!=null ||
         member.GetAttribute(SystemTypes.SpecProtectedAttribute)!=null
         ;
     case MethodFlags.Private:
       return true;
   }
   Debug.Assert(false);
   return false;
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:52,代码来源:Checker.cs

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

示例6: IsInInvariantAllowed

 //member as accesible as the method in which it is used -- used for contracts
 public virtual bool IsInInvariantAllowed(Member member, Method method) {
   if (member == null || method == null) return false;
   if (member is ParameterField) return true;
   switch ((((Method)method).Flags & MethodFlags.MethodAccessMask)) {
     case MethodFlags.Public:
       return member.IsPublic || 
         member.GetAttribute(SystemTypes.SpecPublicAttribute)!= null;
     case MethodFlags.Family:
       return member.IsPublic || member.IsFamily || 
         member.GetAttribute(SystemTypes.SpecPublicAttribute)!= null  || member.GetAttribute(SystemTypes.SpecProtectedAttribute)!= null;
     case MethodFlags.Assembly:
       return member.IsPublic || member.IsAssembly || 
         member.GetAttribute(SystemTypes.SpecPublicAttribute)!= null  || member.GetAttribute(SystemTypes.SpecInternalAttribute)!= null;
     case MethodFlags.FamANDAssem:
       return member.IsPublic || member.IsFamilyAndAssembly ||
         member.GetAttribute(SystemTypes.SpecPublicAttribute)!=null  || 
         (member.GetAttribute(SystemTypes.SpecInternalAttribute)!=null && member.GetAttribute(SystemTypes.SpecProtectedAttribute) != null);
     case MethodFlags.FamORAssem:
       return member.IsPublic || member.IsFamily || member.IsFamilyOrAssembly || member.IsAssembly ||
         member.GetAttribute(SystemTypes.SpecPublicAttribute)!=null  || member.GetAttribute(SystemTypes.SpecInternalAttribute)!=null ||
         member.GetAttribute(SystemTypes.SpecProtectedAttribute)!=null
         ;
     case MethodFlags.Private:
       return member.IsPrivate;
   }
   Debug.Assert(false);
   return false;
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:29,代码来源:Checker.cs

示例7: IsCompilerGenerated

 internal static bool IsCompilerGenerated(Member m) {
   if (m == null) return false;
   if (m.GetAttribute(compilerGeneratedAttributeNode) != null) return true;
   TypeNode t = m.DeclaringType;
   while (t != null) {
     if (IsCompilerGenerated(t)) return true;
     t = t.DeclaringType;
   }
   return false;
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:10,代码来源:PointsToAnalysis.cs


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