本文整理汇总了C#中Attribute.Conditional_GetConditionName方法的典型用法代码示例。如果您正苦于以下问题:C# Attribute.Conditional_GetConditionName方法的具体用法?C# Attribute.Conditional_GetConditionName怎么用?C# Attribute.Conditional_GetConditionName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attribute
的用法示例。
在下文中一共展示了Attribute.Conditional_GetConditionName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyConditionalAttribute
//
// Applies the `Conditional' attribute to the method.
//
protected virtual bool ApplyConditionalAttribute (Attribute a)
{
// The Conditional attribute is only valid on methods.
if (!is_method) {
Attribute.Error_AttributeNotValidForElement (a, Location);
return false;
}
string condition = a.Conditional_GetConditionName ();
if (condition == null)
return false;
if (ReturnType != TypeManager.void_type) {
Report.Error (578, Location,
"Conditional not valid on `" + member.Name + "' " +
"because its return type is not void");
return false;
}
if ((modifiers & Modifiers.OVERRIDE) != 0) {
Report.Error (243, Location,
"Conditional not valid on `" + member.Name + "' " +
"because it is an override method");
return false;
}
if (member.IsExplicitImpl) {
Report.Error (577, Location,
"Conditional not valid on `" + member.Name + "' " +
"because it is an explicit interface implementation");
return false;
}
if (IsImplementing) {
Report.Error (623, Location,
"Conditional not valid on `" + member.Name + "' " +
"because it is an interface method");
return false;
}
conditionals.Add (condition);
return true;
}