I have an enum that FxCop happens to be bugging me about (it's an IdentifiersShouldBeSpelledCorrectly warning), and I actually have good reason to name them as such, so I figured I'd suppress those warnings explicitly in code. However, the only way to do so as far as I can find is to add a SuppressMessage attribute to each member in the enum, which makes the whole thing practically unreadable. Is there any way to tell FxCop to just ignore the IdentifiersShouldBeSpelledCorrectly warning for every member in a certain enumeration?
-
-
How about adding the names of the identifiers to the custom dictionary for the project?
-
Sven Groot said:
How about adding the names of the identifiers to the custom dictionary for the project?
Oh hey, that's also not a bad idea. Thanks.
-
Bas said:Sven Groot said:*snip*
Oh hey, that's also not a bad idea. Thanks.
Or mark the Fxcop messages as Excluded?
I'm not a fan of using attributes like this since, as you say, it makes the code messy.
-
W3bbo said:Bas said:*snip*
Or mark the Fxcop messages as Excluded?
I'm not a fan of using attributes like this since, as you say, it makes the code messy.
Yeah, I thought about doing it in FxCop, but I liked the idea of the code making it clear that the enum members were definitely named that way for a reason.
-
Bas said:W3bbo said:*snip*
Yeah, I thought about doing it in FxCop, but I liked the idea of the code making it clear that the enum members were definitely named that way for a reason.
That's what comments are for

Whilst we're on the subject, I hate having to put Enum member info on their own line in <summary> blocks. I'd prefer it if the C# documentation generator did a similar thing to the C++ doc generator and include // comments made on the same line as the member.
So rather than:
public enum Foo {
/// <summary>Some member (0xFF)</summary>
Bar = 0xFF,
Baz,
}You can do this:
public enum Foo {
Bar = 0xFF, // Some member
Baz,
}I'd also like it if intellisense showed you the numeric value of an enum member rather than having to put a copy in the <summary> comment.
-
W3bbo said:Bas said:*snip*
That's what comments are for

Whilst we're on the subject, I hate having to put Enum member info on their own line in <summary> blocks. I'd prefer it if the C# documentation generator did a similar thing to the C++ doc generator and include // comments made on the same line as the member.
So rather than:
public enum Foo {
/// <summary>Some member (0xFF)</summary>
Bar = 0xFF,
Baz,
}You can do this:
public enum Foo {
Bar = 0xFF, // Some member
Baz,
}I'd also like it if intellisense showed you the numeric value of an enum member rather than having to put a copy in the <summary> comment.
That bugs me too. Anything that makes you put stuff between the members (like summaries or SuppressMessageAttributes) instantly makes the enum annoying to read.
With regards to numerical values: that always felt dodgy to me, for reasons I can't quite put my finger on. I don't know why, but for some reason it feels wrong to not treat the internal value (and type) as anything other than an internal representation of the enum.
That doesn't stop me from doing it, but it still feels wrong.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.