Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions standard/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,11 +543,14 @@
A conditional method is subject to the following restrictions:

- The conditional method shall be a method in a *class_declaration* or *struct_declaration*. A compile-time error occurs if the `Conditional` attribute is specified on a method in an interface declaration.
- The conditional method shall not be an event or property accessor.
- The conditional method shall have a return type of `void`.
- The conditional method shall not be marked with the `override` modifier. A conditional method can be marked with the `virtual` modifier, however. Overrides of such a method are implicitly conditional, and shall not be explicitly marked with a `Conditional` attribute.
- The conditional method shall not be an implementation of an interface method. Otherwise, a compile-time error occurs.
- The parameters of the conditional method shall not be output parameters.

> *Note*: Attributes with an `AttributeUsage` ([§23.2.2](attributes.md#2322-attribute-usage)) including `AttributeTargets.Method` can normally be applied to property accessors and event accessors. The restrictions above prohibit this usage of the `Conditional` attribute. *end note*

In addition, a compile-time error occurs if a delegate is created from a conditional method.

> *Example*: The example
Expand Down Expand Up @@ -953,7 +956,7 @@
> ```csharp
> #nullable enable
> public class X
> {

Check warning on line 959 in standard/attributes.md

View workflow job for this annotation

GitHub Actions / Markdown to Word Converter

standard/attributes.md#L959

MDC032::Line length 86 > maximum 81
> private void ThrowIfNull([DoesNotReturnIf(true)] bool isNull, string argumentName)
> {
> if (!isNull)
Expand Down
Loading