NDepend is a tool that offers a wide range of features to let developers analyze a .NET code base. It comes with about 200 built in rules. But there are a few default rules that do not fit “my rules”. This blog post shows how to customize one and even more important why.

Instance fields should be prefixed with a ’m_'

I prefix instance fields with a ‘’ not with ‘m’ so I need to customize the default rule:

warnif count > 0 from f in Application.Fields where
  !f.NameLike (@"^_") &&
  !f.IsStatic &&
  !f.IsLiteral &&
  !f.IsGeneratedByCompiler  &&
  !f.IsSpecialName &&
  !f.IsEventDelegateObject
select new { f, f.SizeOfInst }