dotnet / dotnet/dotnet-api-docs
1st example: enum does not need terminating semi-colon, and other sins
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
in first example
1. code erroneously add a semicolon at end of each enum statement (after closing curly) but this is not required and they should be removed [RCS1055 3x]
2. FlagsAttribute should have member with zero value, e.g. "None=0," [RCS1135 1X]
3. use of explicit type (e.g. Type, string, Colors) should be replaced by var [IDE0007 4x]
4. foreach should have executing statement surrounded by curly braces [IDE0011 2x]
5. myColors should mark local variable as const (e.g. const Colors myColors) [RCS1118 1Xx]
(OK one less off my #3 smell-list!)
And all the rest of docs to exhibit best patterns & practices
- I got bored enumerating code improvements, but poor examples are plentiful alas
Suggest you put some interns on "find the bad smells" hunt and reward highest score
- anybody worth their salt will channel all doc examples into Roslyn and be done in a jiffy
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 636447d8-cbfd-8fd0-1caa-b9ea5cf39f74
* Version Independent ID: 357fbd3c-5a0d-db79-306b-f4b7fb3f4727
* Content: [Enum Class (System)](https://docs.microsoft.com/en-us/dotnet/api/system.enum?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev15.query%3FappId%3DDev15IDEF1%26l%3DEN-US%26k%3Dk(System.Enum);k(TargetFrameworkMoniker-.NETFramework,Version%3Dv4.6);k(DevLang-csharp)%26rd%3Dtrue%26f%3D255%26MSPPError%3D-2147217396&view=netframework-4.7.2)
* Content Source: [xml/System/Enum.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System/Enum.xml)
* Product: **dotnet-api**
* GitHub Login: @rpetrusha
* Microsoft Alias: **ronpet**
Contributor guide
Assessment
This issue has not been assessed yet.