使用 Code Metrics 的方法很簡單,在『方案(solution)』或『專案(project)』按右鍵『Calculate Code Metrics』即可,如下圖: 分析結果顯示在 Code Metrics Results 視窗中: 如上圖所視,這個功能目前計算 5 個指標:Maintainability Index, Cyclomatic Complexity, Depth of Inheritance, Class Coupling, and Lines of Code。這些值的意義稍後會再討論。