Andrew Stevenson's WebLog

Write Here Write Now

Syndication

.Net Languages

ADO.Net

Asp.Net (Misc.)

Asp.Net Controls

Bad Patterns

Err What?

Files and Folders

Forums

IE Add-Ins

Methods for the Madness

Performance

See Clearer, C#

Test Driven

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  

Published Tuesday, August 03, 2004 9:20 AM by AndrewSeven

Comments

No Comments