私はこのようなコードを持っています:
public abstract class Base
{
// is going to be used in deriving classes
// let's assume foo is threadsafe
protected static readonly Foo StaticFoo = new Foo();
}
Visual Studio 2008 のコード分析で次のメッセージが表示されます。
CA2104 : Microsoft.Security : Remove the read-only designation from 'Base.StaticFoo' or change the field to one that is an immutable reference type. If the reference type 'Foo' is, in fact, immutable, exclude this message.
私のデザインは本質的に欠陥が[SuppressMessage]
ありますか?それともソースに追加できますか?