本文整理汇总了C#中System.Compiler.Member.GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# Member.GetAttribute方法的具体用法?C# Member.GetAttribute怎么用?C# Member.GetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Compiler.Member
的用法示例。
在下文中一共展示了Member.GetAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MemberIsRep
private bool MemberIsRep (Member m) {
if (m == null) return false;
return m.GetAttribute(SystemTypes.RepAttribute) != null;
}
示例2: IsDebuggerNonUserCodeMemberOnly
private static bool IsDebuggerNonUserCodeMemberOnly(Member m)
{
if (m == null) return false;
if (debuggerNonUserCodeAttributeNode == null) return false;
if (m.GetAttribute(debuggerNonUserCodeAttributeNode) != null) return true;
return false;
}
示例3: CopyAttributesWithoutDuplicateUnlessAllowMultiple
private void CopyAttributesWithoutDuplicateUnlessAllowMultiple(Member targetMember, Member sourceMember)
{
Contract.Requires(targetMember != null);
Contract.Requires(sourceMember != null);
// if (sourceMember.Attributes == null) return;
// if (targetMember.Attributes == null) targetMember.Attributes = new AttributeList();
var attrs = this.outOfBandDuplicator.VisitAttributeList(sourceMember.Attributes);
Contract.Assume(attrs != null, "We fail to specialize the ensures");
foreach (var a in attrs)
{
if (a == null) continue;
// Can't look at a.Type because that doesn't get visited by the VisitAttributeList above
// (Seems like a bug in the StandardVisitor...)
TypeNode typeOfA = AttributeType(a);
if (!a.AllowMultiple && targetMember.GetAttribute(typeOfA) != null)
{
continue;
}
targetMember.Attributes.Add(a);
}
}