本文整理汇总了C#中System.Reflection.EventInfo.IsDefined方法的典型用法代码示例。如果您正苦于以下问题:C# EventInfo.IsDefined方法的具体用法?C# EventInfo.IsDefined怎么用?C# EventInfo.IsDefined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.EventInfo
的用法示例。
在下文中一共展示了EventInfo.IsDefined方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEventOptions
public ProxyOptions GetEventOptions( EventInfo e )
{
ProxyOptions opt = new ProxyOptions();
opt.CatchExceptions = _errorCatch == CatchExceptionGeneration.Always
|| (_errorCatch == CatchExceptionGeneration.HonorIgnoreExceptionAttribute
&& !e.IsDefined( typeof( IgnoreExceptionAttribute ), false ));
if( _isDynamicService )
{
bool stopAllowed = e.IsDefined( typeof( IgnoreServiceStoppedAttribute ), false );
opt.RuntimeCheckStatus = stopAllowed ? ProxyOptions.CheckStatus.NotDisabled : ProxyOptions.CheckStatus.Running;
}
else opt.RuntimeCheckStatus = ProxyOptions.CheckStatus.None;
return opt;
}
示例2: InternalIsDefined
private static bool InternalIsDefined (EventInfo element, Type attributeType, bool inherit)
{
Contract.Requires(element != null);
// walk up the hierarchy chain
if (element.IsDefined(attributeType, inherit))
return true;
if (inherit)
{
AttributeUsageAttribute usage = InternalGetAttributeUsage(attributeType);
if (!usage.Inherited)
return false;
EventInfo baseEvent = GetParentDefinition(element);
while (baseEvent != null)
{
if (baseEvent.IsDefined(attributeType, false))
return true;
baseEvent = GetParentDefinition(baseEvent);
}
}
return false;
}
示例3: InternalIsDefined
private static bool InternalIsDefined(EventInfo element, Type attributeType, bool inherit)
{
if (element.IsDefined(attributeType, inherit))
{
return true;
}
if (inherit)
{
if (!InternalGetAttributeUsage(attributeType).Inherited)
{
return false;
}
for (EventInfo info = GetParentDefinition(element); info != null; info = GetParentDefinition(info))
{
if (info.IsDefined(attributeType, false))
{
return true;
}
}
}
return false;
}
示例4: InternalIsDefined
private static bool InternalIsDefined(EventInfo element, Type attributeType, bool inherit)
{
if (element.IsDefined(attributeType, inherit))
{
return true;
}
if (inherit)
{
AttributeUsageAttribute attributeUsageAttribute = Attribute.InternalGetAttributeUsage(attributeType);
if (!attributeUsageAttribute.Inherited)
{
return false;
}
EventInfo parentDefinition = Attribute.GetParentDefinition(element);
while (parentDefinition != null)
{
if (parentDefinition.IsDefined(attributeType, false))
{
return true;
}
parentDefinition = Attribute.GetParentDefinition(parentDefinition);
}
}
return false;
}
示例5: AcceptEvent
/// <inheritdoc/>
public bool AcceptEvent(EventInfo eventInfo)
{
return !eventInfo.IsDefined(typeof (NonInterceptedAttribute), false);
}
示例6: InternalIsDefined
private static bool InternalIsDefined(EventInfo element, Type attributeType, bool inherit)
{
if (element.IsDefined(attributeType, inherit))
return true;
if (inherit && Attribute.InternalGetAttributeUsage(attributeType).Inherited)
{
for (EventInfo parentDefinition = Attribute.GetParentDefinition(element); parentDefinition != null; parentDefinition = Attribute.GetParentDefinition(parentDefinition))
{
if (parentDefinition.IsDefined(attributeType, false))
return true;
}
}
return false;
}