using System; /// /// GOOD: Class documented correctly /// public class Class1 { protected class Exception1 : ArgumentException { } protected class Exception2 : ArgumentException { } /// /// GOOD: This public method is documented correctly /// /// First parameter /// Second parameter /// Only via exception /// Exception 1 /// Exception 2 public virtual int method1(int p1, int p2) { throw new Exception1(); throw new Exception2(); } /// BAD: This XML comment is missing several tags /// BAD: This parameter does not exist /// BAD: This should say Exception2 public int method2(int p1, int p2) { return p1 > 0 ? throw new Exception2() : p2; } // BAD: Missing documentation comment public int method3() { return 0; } // GOOD: This internal comment does not need documentation internal int method4() { return 0; } // BAD: Public class is not documented public class Class2 { } // GOOD: Private class does not need documentation class Class3 { } // GOOD: Constructor is private private Class1(string s) { } /// /// GOOD: Constructor is correctly documented /// /// The parameter public Class1(int p) { } // BAD: Constructor is public and not documented public Class1(int a, int b) { } /// /// BAD: Missing a typeparam /// BAD: Contains an extra typeparam /// /// The type class Class4 { } /// /// GOOD: Type params are correctly labeled /// /// First type /// Second type class Class5 { } /// /// BAD: Missing a typeparam on a method /// BAD: Contains an extra typeparam /// /// BAD typeparam /// GOOD typeparam void method5() { } // BAD: These fields are empty /// /// /// /// /// public virtual int method4(int p1, int p2) { return p1; } } class Class2 : Class1 { // GOOD /// public Class2(int i) : base(i) { } // GOOD /// public override int method1(int p1, int p2) { throw new Exception1(); throw new Exception2(); } // GOOD: Even if the overridden method is bad. /// public override int method4(int p1, int p2) { return p1; } // GOOD: Has an attribute [My1] public void method5() { } // BAD: Has only System.Runtime.CompilerServices attribute [System.Runtime.CompilerServices.My2] public void method6() { } } internal class My1Attribute : Attribute { } namespace System.Runtime.CompilerServices { internal class My2Attribute : Attribute { } }