Skip to content

Improve ConditionalAttribute documentation #3522

Open
@svick

Description

@svick

I think ConditionalAttribute is one of the more confusing features of C#/.Net, so it's important that it's well documented.

Some of the ways in which the document could be improved:

  • Make sure it's clear that when the C# compiler removes a call to a method, it also removes its receiver and parameters, which can have side-effects. See ConditionalAttribute removes too much from the call site roslyn#28801. This should include updating both remarks and the example.
  • Clarify the description of the example: it says it assumes using /define, but then the code has #define.
  • Improve the example, so that ConditionalAttribute actually affects its output.
  • Either make the list of ways of specifying conditional compilation symbols include the two that I think are most commonly used (use the VS IDE, edit .Net Core SDK .csproj) or link to an article that does.
  • The article says that you can set conditional compilation symbols though environment variables. Is that really true?
  • Remove mention of JScript, add F#.
  • I don't understand the note about VB and AddressOf. If it's saying something useful, it should be clarified.

Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions