Export (0) Print
Expand All

B.3.2 ID string examples

Visual Studio .NET 2003

The following examples each show a fragment of C# code, along with the ID string produced from each source element capable of having a documentation comment:

  • Types are represented using their fully qualified name.
    enum Color { Red, Blue, Green }
    namespace Acme
    {
       interface IProcess {...}
       struct ValueType {...}
       class Widget: IProcess
       {
          public class NestedClass {...}
          public interface IMenuItem {...}
          public delegate void Del(int i);
          public enum Direction { North, South, East, West }
       }
    }
    "T:Color"
    "T:Acme.IProcess"
    "T:Acme.ValueType"
    "T:Acme.Widget"
    "T:Acme.Widget.NestedClass"
    "T:Acme.Widget.IMenuItem"
    "T:Acme.Widget.Del"
    "T:Acme.Widget.Direction"
    
  • Fields are represented by their fully qualified name.
    namespace Acme
    {
       struct ValueType
       {
          private int total;
       }
       class Widget: IProcess
       {
          public class NestedClass
          {
             private int value;
          }
          private string message;
          private static Color defaultColor;
          private const double PI = 3.14159;
          protected readonly double monthlyAverage;
          private long[] array1;
          private Widget[,] array2;
          private unsafe int *pCount;
          private unsafe float **ppValues;
       }
    }
    "F:Acme.ValueType.total"
    "F:Acme.Widget.NestedClass.value"
    "F:Acme.Widget.message"
    "F:Acme.Widget.defaultColor"
    "F:Acme.Widget.PI"
    "F:Acme.Widget.monthlyAverage"
    "F:Acme.Widget.array1"
    "F:Acme.Widget.array2"
    "F:Acme.Widget.pCount"
    "F:Acme.Widget.ppValues"
    
  • Constructors.
    namespace Acme
    {
       class Widget: IProcess
       {
          static Widget() {...}
          public Widget() {...}
          public Widget(string s) {...}
       }
    }
    "M:Acme.Widget.#cctor"
    "M:Acme.Widget.#ctor"
    "M:Acme.Widget.#ctor(System.String)"
    
  • Destructors.
    namespace Acme
    {
       class Widget: IProcess
       {
          ~Widget() {...}
       }
    }
    "M:Acme.Widget.Finalize"
    
  • Methods.
    namespace Acme
    {
       struct ValueType
       {
          public void M(int i) {...}
       }
       class Widget: IProcess
       {
          public class NestedClass
          {
             public void M(int i) {...}
          }
          public static void M0() {...}
          public void M1(char c, out float f, ref ValueType v) {...}
          public void M2(short[] x1, int[,] x2, long[][] x3) {...}
          public void M3(long[][] x3, Widget[][,,] x4) {...}
          public unsafe void M4(char *pc, Color **pf) {...}
          public unsafe void M5(void *pv, double *[][,] pd) {...}
          public void M6(int i, params object[] args) {...}
       }
    }
    "M:Acme.ValueType.M(System.Int32)"
    "M:Acme.Widget.NestedClass.M(System.Int32)"
    "M:Acme.Widget.M0"
    "M:Acme.Widget.M1(System.Char,System.Single@,Acme.ValueType@)"
    "M:Acme.Widget.M2(System.Int16[],System.Int32[0:,0:],System.Int64[][])"
    "M:Acme.Widget.M3(System.Int64[][],Acme.Widget[0:,0:,0:][])"
    "M:Acme.Widget.M4(System.Char*,Color**)"
    "M:Acme.Widget.M5(System.Void*,System.Double*[0:,0:][])"
    "M:Acme.Widget.M6(System.Int32,System.Object[])"
    
  • Properties and indexers.
    namespace Acme
    {
       class Widget: IProcess
       {
          public int Width { get {...} set {...} }
          public int this[int i] { get {...} set {...} }
          public int this[string s, int i] { get {...} set {...} }
       }
    }
    "P:Acme.Widget.Width"
    "P:Acme.Widget.Item(System.Int32)"
    "P:Acme.Widget.Item(System.String,System.Int32)"
    
  • Events.
    namespace Acme
    {
       class Widget: IProcess
       {
          public event Del AnEvent;
       }
    }
    "E:Acme.Widget.AnEvent"
    
  • Unary operators.
    namespace Acme
    {
       class Widget: IProcess
       {
          public static Widget operator+(Widget x) {...}
       }
    }
    "M:Acme.Widget.op_UnaryPlus(Acme.Widget)"
    

    The complete set of unary operator function names used is as follows: op_UnaryPlus, op_UnaryNegation, op_LogicalNot, op_OnesComplement, op_Increment, op_Decrement, op_True, and op_False.

  • Binary operators.
    namespace Acme
    {
       class Widget: IProcess
       {
          public static Widget operator+(Widget x1, Widget x2) {...}
       }
    }
    "M:Acme.Widget.op_Addition(Acme.Widget,Acme.Widget)"
    

    The complete set of binary operator function names used is as follows: op_Addition, op_Subtraction, op_Multiply, op_Division, op_Modulus, op_BitwiseAnd, op_BitwiseOr, op_ExclusiveOr, op_LeftShift, op_RightShift, op_Equality, op_Inequality, op_LessThan, op_LessThanOrEqual, op_GreaterThan, and op_GreaterThanOrEqual.

  • Conversion operators have a trailing "~" followed by the return type.
    namespace Acme
    {
       class Widget: IProcess
       {
          public static explicit operator int(Widget x) {...}
          public static implicit operator long(Widget x) {...}
       }
    }
    "M:Acme.Widget.op_Explicit(Acme.Widget)~System.Int32"
    "M:Acme.Widget.op_Implicit(Acme.Widget)~System.Int64"
    
Show:
© 2014 Microsoft