Skip to content

Remove @ from variables that are not keywords #747

@giggio

Description

@giggio

We should only use verbatim identifiers (identifiers prefixed with @) for keywords, like public, private, etc.

More info on identifiers in C#:
https://msdn.microsoft.com/en-us/library/aa664670%28VS.71%29.aspx

Before:

var @foo = 1;
@foo++;

After:

var foo = 1;
foo++;

Should work on any identifier (arguments, etc). Example:

namespace @ConsoleApplication3
{
    class @Program
    {
        private string @b;
        public event EventHandler @e;
        static void Main(string[] args)
        {
            var @a = "";
        }
        public void @Foo()
        {
        }
        public int @MyProperty { get; set; }
    }
}

Diagnostic Id: CC0117
Category: Style
Severity: Info

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