Hello All,
I have a class where I want to define some messages. I know this is a performance issue but I want to code it like that :
namespace
MyNs{
public static class Msg{
public static readonly string Msg1 = "My Msg";}
}
So when I run the code analysis I receive the error message CA1802 saying that I should transform the static readonly into const. I want to suppress this message but I do not want to put it on the member Msg1 cause I have several like that.
I have tried the following Suppression but none work:
[SuppressMessage("Microsoft.Performance", "CA1802:UseLiteralsWhereAppropriate", Scope = "type", Target = "MyNs.Msg")]
[SuppressMessage("Microsoft.Performance", "CA1802:UseLiteralsWhereAppropriate", Scope = "member", Target = "MyNs.Msg")]
[assembly: SuppressMessage("Microsoft.Performance", "CA1802:UseLiteralsWhereAppropriate", Scope = "type", Target = "MyNs.Msg")]
[assembly: SuppressMessage("Microsoft.Performance", "CA1802:UseLiteralsWhereAppropriate", Scope = "member", Target = "MyNs.Msg")]
Do you have any idea of how I can suppress this message (I do not want to suppress it globally in the project).
Thanks,