My Goal: Create a C# class for predefined errors that have both an ID and a Message. Here was what I tried:
public class MyError
{
public static readonly
Your type is not mutable, but Code Analysis doesn't know that.
This warning is a false positive; you should suppress it.
To answer your edited question:
const
can only be applied to primitives.
For custom types, static readonly
is the only option.
As long as the type is properly immutable, it will work perfectly.