#眉標=VSTS2008、FxCop、Introspection #副標=Visual Studio Team System 2008實戰攻略(10) #大標=自訂規則之程式碼分析 #作者=文/圖 歐宣修 ===<反灰>============= namespace VSTS.CodeAnalysis { public class ClassNamespace : BaseIntrospectionRule //...(1) { public ClassNamespace() : base("ClassNamespace", "VSTS.CodeAnalysis.CustomRules", typeof(ClassNamespace).Assembly) {} //…(2) public override ProblemCollection Check( string namespaceName, TypeNodeCollection types) //…(3) { if (namespaceName.IndexOf("Runpc") < 0) //Not found { this.Problems.Add(new Problem( this.GetResolution(new string[] {namespaceName}))); //…(4) } return this.Problems; } } } ================ ===<反灰>============= Namespace of class or interface must include "Runpc" Namespace of class is illegal. Namespace '{0}' must include "Runpc". Warning NonBreaking ================ ============= 備註 註1:FxCop官網:http://blogs.msdn.com/fxcop/ 註2:http://www.binarycoder.net/fxcop/ 註3:http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=98&SiteID=1 註4:http://www.binarycoder.net/fxcop/introspector.zip ================