FxCop :: Do not declare explicit static constructors. Ignoreable?
I have this utility class nested in annother class and FxCop gives me a Critical warning.
DoNotDeclareExplicitStaticConstructors.html
I don't really think I have annother way to do it. Everything, including the ProductFields, is static or constant.
public class FieldSets
{
public static readonly string Minimal;
static FieldSets()
{
CatalogSystemBase.FieldSets.Minimal = CreateFieldSet(ProductFields.ProductID,ProductFields.ProductName);
}
protected static string CreateFieldSet(string fieldSet,string fieldName)
{
return CreateFieldSet(new string[]{fieldSet,fieldName});
}
protected static string CreateFieldSet(params string[] fieldNames)
{
return String.Join(",",fieldNames);
}
}
Added links to ctor stuff.
Perf penalty Static Constructor (Brad Abrams)
http://blogs.msdn.com/brada/archive/2004/04/17/115300.aspx
Quiz: Type Constructors (Brad Abrams)
http://blogs.msdn.com/brada/archive/2004/08/15/214948.aspx