How do I get a warning in Visual Studio when async methods don't end in 'Async'?

  • A+
Category:Languages

How can I get Visual Studio to give me a naming warning each time I create an asynchronous method that doesn't end "Async"?

It's the recommended convention for asynchronous methods, but I often find myself forgetting to add that suffix and a warning would be useful.

 


From Options,

  • Go to Text EditorBasicCode Style → Naming
  • Select Manage Specifications and Add New Specification
  • Select Method, tick all accessibility options and from Modifiers, select Async.
  • Give the title as Async Method and save
  • Now get into Manage Naming Styles and add New Style. Add Async as suffix and give it a name as AsyncSuffix, and then save
  • Now press the plus sign and create new naming. Select specification as Async Method, select required Style as AsyncPostfix and Severity as Suggestor.
  • Click OK and save

How do I get a warning in Visual Studio when async methods don't end in 'Async'?

How do I get a warning in Visual Studio when async methods don't end in 'Async'?

How do I get a warning in Visual Studio when async methods don't end in 'Async'?

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: