using System; using System.Collections; using System.Collections.Generic; using System.Linq; /// Namespace Test: [] /// T:NoNamespace public class NoNamespace {} namespace System { /* * The System namespace gets special treatment, e.g. instead of * System.Environment C# declarations it's just Environment. */ /// T:System.Action`1 public delegate void Action (T obj); /// T:System.Environment public static class Environment { /// T:System.Environment+SpecialFolder public enum SpecialFolder {} /// /// A instance. /// /// /// M:System.Environment.GetFolderPath(System.Environment+SpecialFolder) /// public static string GetFolderPath (SpecialFolder folder) { throw new NotSupportedException (); } } // to test ECMA doc importing... public class Array { // the ECMA docs have a different return type than .NET -- skip. public static System.Collections.ObjectModel.ReadOnlyCollection AsReadOnly (T[] array) { throw new NotImplementedException (); } // ECMA docs use instead of --> map them. public static TOutput[] ConvertAll (TInput[] array, Converter converter) { throw new InvalidOperationException (); } // ECMA docs *incorrectly* document parameter -- skip public static void Resize (ref T[] array, int newSize) { throw new Exception (); } } // to test ECMA doc importing... public delegate void AsyncCallback (IAsyncResult ar); } namespace Mono.DocTest { internal class Internal { public class ShouldNotBeDocumented { } } internal class MonoTODOAttribute : Attribute { } /// /// /// cref=T:Mono.DocTest.DocAttribute. /// /// /// /// /// /// /// /// ///
redbluegreen
///
/// ///
[AttributeUsage (AttributeTargets.All)] public class DocAttribute : Attribute { #region DocAttribute Example [Doc ("documented class")] class Example { [Doc ("documented field")] public string field; } #endregion /// C:Mono.DocTest.DocAttribute(System.String) public DocAttribute (string docs) { if (docs == null) throw new ArgumentNullException ("docs"); } /// P:Mono.DocTest.DocAttribute.Property public Type Property { get; set; } /// F:Mono.DocTest.DocAttribute.Field public bool Field; /// F:Mono.DocTest.DocAttribute.FlagsEnum public ConsoleModifiers FlagsEnum; /// F:Mono.DocTest.DocAttribute.NonFlagsEnum public Color NonFlagsEnum; } /// Possible colors /// /// . /// Namespace Test: [] /// [MonoTODO] public enum Color { /// Insert Red summary here /// F:Mono.DocTest.Color.Red. Red, /// Insert Blue summary here /// F:Mono.DocTest.Color.Blue. Blue, /// Insert Green summary here /// F:Mono.DocTest.Color.Green. Green, AnotherGreen = Green, } /// Process interface /// T:Mono.DocTest.IProcess. public interface IProcess {} /// Process interface /// T:Mono.DocTest.DocValueType. public struct DocValueType : IProcess { /// F:Mono.DocTest.DocValueType.total. public int total; /// A . /// . public void M (int i) { if ((new Random().Next() % 2) == 0) throw new SystemException (); throw new ApplicationException (); } } /// T:Mono.DocTest.D public delegate dynamic D (Func value); /// T:Mono.DocTest.Widget. /// /// Some extra tag value public unsafe class Widget : IProcess { /// T:Mono.DocTest.Widget.NestedClass. public class NestedClass { /// F:Mono.DocTest.Widget.NestedClass.value. public int value; /// Some . /// M:Mono.DocTest.Widget.NestedClass.M(System.Int32). public void M (int i) {} /// T:Mono.DocTest.Widget.NestedClass.Double. public class Double { /// T:Mono.DocTest.Widget.NestedClass.Double.Triple. public class Triple { /// T:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple. public class Quadruple {} // for good measure } } } /// T:Mono.DocTest.Widget.NestedClass`1. public class NestedClass { /// F:Mono.DocTest.Widget.NestedClass`1.value. public int value; /// Another . /// M:Mono.DocTest.Widget.NestedClass`1.M(System.Int32). public void M (int i) {} } /// F:Mono.DocTest.Widget.classCtorError. public static readonly string[] classCtorError = CreateArray (); private static string[] CreateArray () { throw new NotSupportedException (); } /// F:Mono.DocTest.Widget.message. public string message; /// F:Mono.DocTest.Widget.defaultColor. protected static Color defaultColor; /// F:Mono.DocTest.Widget.PI. protected internal const double PI = 3.14159; /// F:Mono.DocTest.Widget.monthlyAverage. internal protected readonly double monthlyAverage; /// F:Mono.DocTest.Widget.array1. public long[] array1; /// F:Mono.DocTest.Widget.array2. public Widget[,] array2; /// F:Mono.DocTest.Widget.pCount. public unsafe int *pCount; /// F:Mono.DocTest.Widget.ppValues. public unsafe float **ppValues; /// T:Mono.DocTest.Widget.IMenuItem. public interface IMenuItem { /// M:Mono.DocTest.Widget.IMenuItem.A. void A (); /// P:Mono.DocTest.Widget.IMenuItem.P. int B {get; set;} } /// T:Mono.DocTest.Widget.Del. public delegate void Del (int i); /// T:Mono.DocTest.Widget.Direction. [Flags] protected internal enum Direction { /// T:Mono.DocTest.Widget.Direction.North. North, /// T:Mono.DocTest.Widget.Direction.South. South, /// T:Mono.DocTest.Widget.Direction.East. East, /// T:Mono.DocTest.Widget.Direction.West. West, } /// /// C:Mono.DocTest.Widget. /// M:Mono.DocTest.Widget.#ctor. /// /// /// public Widget () {} /// A . /// /// C:Mono.DocTest.Widget(System.String). /// M:Mono.DocTest.Widget.#ctor(System.String). /// public Widget (string s) {} /// A . /// /// C:Mono.DocTest.Widget(System.Converter{System.String,System.String}). /// public Widget (Converter c) {} /// M:Mono.DocTest.Widget.M0. public static void M0 () {} /// A . /// A . /// A . /// M:Mono.DocTest.Widget.M1(System.Char,System.Signle@,Mono.DocTest.DocValueType@). [return:Doc ("return:DocAttribute", Property=typeof(Widget))] [Doc("normal DocAttribute", Field=true)] public void M1 ([Doc ("c", FlagsEnum=ConsoleModifiers.Alt | ConsoleModifiers.Control)] char c, [Doc ("f", NonFlagsEnum=Color.Red)] out float f, [Doc ("v")] ref DocValueType v) {f=0;} /// A array. /// A array. /// A array. /// M:Mono.DocTest.Widget.M2(System.Int16[],System.Int32[0:,0:],System.Int64[][]). public void M2 (short[] x1, int[,] x2, long[][] x3) {} /// Another array. /// A array. /// M:Mono.DocTest.Widget.M3(System.Int64[][],Mono.DocTest.Widget[0:,0:,0:][]). protected void M3 (long[][] x3, Widget[][,,] x4) {} /// A pointer. /// A pointer. /// M:Mono.DocTest.Widget.M4(System.Char*,Mono.DocTest.Color**). protected unsafe void M4 (char *pc, Color **ppf) {} /// A pointer. /// A array. /// M:Mono.DocTest.Widget.M5(System.Void*,System.Double*[0:,0:][]). protected unsafe void M5 (void *pv, double *[][,] pd) {} /// Yet another . /// An array. /// M:Mono.DocTest.Widget.M6(System.Int32,System.Object[]). protected void M6 (int i, params object[] args) {} /// M:Mono.DocTest.Widget.M7(Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple). public void M7(Widget.NestedClass.Double.Triple.Quadruple a) {} /// A value... /// P:Mono.DocTest.Widget.Width. [Doc ("Width property")] public int Width { [Doc ("Width get accessor")] get {return 0;} [Doc ("Width set accessor")] protected set {} } /// A value... /// P:Mono.DocTest.Widget.Height. [Doc ("Height property")] protected long Height {get {return 0;}} /// A value... /// P:Mono.DocTest.Widget.X. protected internal short X {set {}} /// A value... /// P:Mono.DocTest.Widget.Y. internal protected double Y {get {return 0;} set {}} /// TODO /// P:Mono.DocTest.Widget.Item(System.Int32). /// A instance. [Doc ("Item property")] public int this [int i] { get {return 0;} [Doc ("Item property set accessor")] set {} } /// Some . /// I love s. /// P:Mono.DocTest.Widget.Item(System.String,System.Int32). /// A instance. public int this [string s, int i] {get {return 0;} set {}} /// E:Mono.DocTest.Widget.AnEvent. [Doc ("Del event")] public event Del AnEvent { [Doc ("Del add accessor")] add {} [Doc ("Del remove accessor")] remove {} } /// E:Mono.DocTest.Widget.AnotherEvent. protected event Del AnotherEvent; /// Another . /// M:Mono.DocTest.Widget.op_UnaryPlus(Mono.DocTest.Widget). /// A instance. public static Widget operator+ (Widget x) {return null;} /// M:Mono.DocTest.Widget.op_Division. /// A instance. public static Widget op_Division = null; /// Yet Another . /// Yay, s. /// M:Mono.DocTest.Widget.op_Addition(Mono.DocTest.Widget,Mono.DocTest.Widget). /// A instance (2). public static Widget operator+ (Widget x1, Widget x2) {return null;} /// s are fun!. /// M:Mono.DocTest.Widget.op_Explicit(Mono.DocTest.Widget)~System.Int32. /// A instance. public static explicit operator int (Widget x) {return 0;} /// foo; . /// M:Mono.DocTest.Widget.op_Implicit(Mono.DocTest.Widget)~System.Int64. /// A instance. public static implicit operator long (Widget x) {return 0;} /// M:Mono.DocTest.Widget.Default(System.Int32,System.Int32) public void Default (int a = 1, int b = 2) {} /// M:Mono.DocTest.Widget.Default(System.String,System.Char) public void Default (string a = "a", char b = 'b') {} /// M:Mono.DocTest.Widget.Dynamic0(System.Object,System.Object) public dynamic Dynamic0 (dynamic a, dynamic b) {return a + b;} /// M:Mono.DocTest.Widget.Dynamic1(System.Collections.Generic.Dictionary{System.Object,System.Object}) public Dictionary Dynamic1 (Dictionary value) {return value;} /// M:Mono.DocTest.Widget.Dynamic2(System.Func{System.String,System.Object}) public Func Dynamic2 (Func value) {return value;} /// M:Mono.DocTest.Widget.Dynamic3(System.Func{System.Func{System.String,System.Object},System.Func{System.Object,System.String}}) public Func, Func> Dynamic3 ( Func, Func> value) {return value;} /// P:Mono.DocTest.Widget.DynamicP public Func, Func, string>> DynamicP { get {return null;} } /// F:Mono.DocTest.Widget.DynamicF public Func, Func, string>> DynamicF; /// E:Mono.DocTest.Widget.DynamicE1 [Obsolete ("why not")] public event Func DynamicE1; /// E:Mono.DocTest.Widget.DynamicE2 public event Func DynamicE2 { add {} remove {} } } /// T:Mono.DocTest.UseLists. public class UseLists { /// A . /// M:Mono.DocTest.UseLists.Process(Mono.DocTest.MyList{System.Int32}). public void Process (Generic.MyList list) {} /// A T. /// Something /// M:Mono.DocTest.UseLists.GetValues``1(``0). /// A instance. public Generic.MyList GetValues (T value) where T : struct {return null;} /// Another . /// /// M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32}). /// /// /// text! /// text! public void Process (List list) { // Bug: only creation is looked for, so this generates an // node: new Exception (); // Bug? We only look at "static" types, so we can't follow // delegates/interface calls: Func a = x => {throw new InvalidOperationException ();}; a (1); // Multi-dimensional arrays have "phantom" methods that Cecil can't // resolve, as they're provided by the runtime. These should be // ignored. int[,] array = new int[1,1]; array[0,0] = 42; } /// A . /// M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}}). public void Process (List> list) { if (list == null) throw new ArgumentNullException ("list"); Process (list); } /// A . /// Something Else /// M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}}). public void Process (List> list) { if (list.Any (p => p == null)) throw new ArgumentException ("predicate null"); } /// A . /// T /// U /// V /// M:Mono.DocTest.UseLists.UseHelper``3(Mono.DocTest.Generic.MyList{``0}.Helper{``1,``2}). public void UseHelper (Generic.MyList.Helper helper) {} } } namespace Mono.DocTest.Generic { // Need to place this into a separate namespace to work around gmcs bug // where XML docs for type *following* this one aren't extracted. /// argument type, with attributes! /// return type, with attributes! /// T:Mono.DocTest.Generic.Func`2. [Doc ("method")] [return:Doc ("return", Field=false)] public delegate TRet Func<[Doc ("arg!")] in TArg, [Doc ("ret!")] out TRet> ( [Doc ("arg-actual")] TArg a ) where TArg : Exception; } namespace Mono.DocTest.Generic { using Mono.DocTest; /// extension methods! /// T:Mono.DocTest.Generic.Extensions public static class Extensions { /// System.Object extension method /// M:Mono.DocTest.Generic.Extensions.ToEnumerable``1 public static IEnumerable ToEnumerable (this T self) { yield return self; } /// extension method /// M:Mono.DocTest.Generic.Extensions.ForEach``1 public static void ForEach (this IEnumerable self, Action a) { } /// extension method /// M:Mono.DocTest.Generic.Extensions.Bar``1 public static void Bar (this IFoo self, string s) { } /// /// /// extension method. /// /// M:Mono.DocTest.Generic.Extensions.ToDouble public static IEnumerable ToDouble (this IEnumerable list) { return null; } /// /// extension method. /// /// M:Mono.DocTest.Generic.Extensions.ToDouble public static double ToDouble (this T val) where T : IFoo { // the target type is T:...IFoo, NOT T:System.Object. return 0.0; } } /// Insert text here. /// T:Mono.DocTest.Generic.GenericBase`1. public class GenericBase { /// Something /// Insert more text here. /// M:Mono.DocTest.GenericBase`1.BaseMethod``1(``0). /// The default value. public U BaseMethod<[Doc ("S")] S> (S genericParameter) { return default(U); } /// F:Mono.DocTest.GenericBase`1.StaticField1 public static readonly GenericBase StaticField1 = new GenericBase (); /// F:Mono.DocTest.GenericBase`1.ConstField1 public const int ConstField1 = 1; /// Insert description here /// M:Mono.DocTest.GenericBase`1.op_Explicit(Mono.DocTest.GenericBase{`0})~`0 /// The default value for . public static explicit operator U (GenericBase list) {return default(U);} /// T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs public class FooEventArgs : EventArgs { } /// E:Mono.DocTest.Generic.GenericBase`1.MyEvent public event EventHandler MyEvent; /// E:Mono.DocTest.Generic.GenericBase`1.ItemChanged public event Action, MyList.Helper> ItemChanged; /// T:Mono.DocTest.Generic.GenericBase`1.NestedCollection public class NestedCollection { /// T:Mono.DocTest.Generic.GenericBase`1.NestedCollection.Enumerator protected internal struct Enumerator { } } } /// I'm Dying Here! /// T:Mono.DocTest.Generic.MyList`1. public class MyList<[Mono.DocTest.Doc("Type Parameter!")] T> : GenericBase , IEnumerable { /// Seriously! /// Too many docs! /// T:Mono.DocTest.MyList`1.Helper`2. public class Helper { /// Ako /// bko /// cko /// M:Mono.DocTest.MyList`1.Helper`2.UseT(`0,`1,`2). public void UseT(T a, U b, V c) { } } /// tko /// M:Mono.DocTest.MyList`1.Test(`0). public void Test (T t) {} /// Class generic type /// Method generic type /// Method generic parameter /// M:Mono.DocTest.MyList`1.Method``1(`0,``0). public void Method (T t, U u) {} // mcs "crashes" (CS1569) on this method; exclude it for now. // M:Mono.DocTest.MyList`1.RefMethod``1(`0@,``0@). public void RefMethod (ref T t, ref U u) {} /// A . /// Argh! /// Foo Argh! /// M:Mono.DocTest.Generic.MyList`1.UseHelper``2(Mono.DocTest.Generic.MyList{``0}.Helper{``1,``2}). public void UseHelper (Helper helper) {} /// M:Mono.DocTest.Generic.MyList`1.GetHelper``2. /// . public Helper GetHelper () {return null;} /// M:Mono.DocTest.MyList`1.System#Collections#GetEnumerator. IEnumerator IEnumerable.GetEnumerator () {return null;} /// M:Mono.DocTest.MyList`1.GetEnumerator. public IEnumerator GetEnumerator () {return null;} } /// T generic param /// T:Mono.DocTest.IFoo`1. public interface IFoo { /// U generic param /// T:Mono.DocTest.IFoo`1.Method``1(`0,``0). T Method (T t, U u); } /// Ako generic param /// Bko generic param /// T:Mono.DocTest.MyList`2. public class MyList : GenericBase>, IEnumerable, IEnumerator, ICollection, IFoo where A : class, IList, new() where B : class, A { // IEnumerator // shown? object IEnumerator.Current {get {return null;}} /// M:Mono.DocTest.MyList`2.MoveNext. /// public bool MoveNext () {return false;} /// M:Mono.DocTest.MyList`2.Reset. public void Reset () {} // IDisposable /// M:Mono.DocTest.MyList`2.Dispose. public void Dispose () {} // IEnumerator /// P:Mono.DocTest.MyList`2.Current. /// The current value. public A Current {get {return default(A);}} /// P:Mono.DocTest.MyList`2.Current. /// The current value. A IEnumerator.Current {get {return default(A);}} // IEnumerable /// M:Mono.DocTest.MyList`2.System#Collections#GetEnumerator. IEnumerator IEnumerable.GetEnumerator () {return this;} // IEnumerable /// M:Mono.DocTest.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator. /// A . IEnumerator IEnumerable.GetEnumerator () {return this;} /// M:Mono.DocTest.MyList`2.GetEnumerator. /// A . public List.Enumerator GetEnumerator () {return new List.Enumerator ();} // ICollection /// P:Mono.DocTest.MyList`2.Count. /// A . public int Count {get {return 0;}} /// P:Mono.DocTest.MyList`2.System#Collections#Generic#ICollection{A}#IsReadOnly. /// A . bool ICollection.IsReadOnly {get {return false;}} /// The item to add. /// M:Mono.DocTest.MyList`2.System#Collections#Generic#ICollection{A}#Add(`0). void ICollection.Add (A item) {} /// M:Mono.DocTest.MyList`2.System#Collections#Generic#ICollection{A}#Clear. void ICollection.Clear () {} /// The item to check for /// M:Mono.DocTest.MyList`2.System#Collections#Generic#ICollection{A}.Contains(`0). /// A instance (). bool ICollection.Contains (A item) {return false;} /// Where to copy elements to /// Where to start copyingto /// M:Mono.DocTest.MyList`2.CopyTo(`0[],System.Int32). public void CopyTo (A[] array, int arrayIndex) {} /// the item to remove /// M:Mono.DocTest.MyList`2.System#Collections#Generic#ICollection{A}#Remove(`0). /// Whether the item was removed. bool ICollection.Remove (A item) {return false;} /// M:Mono.DocTest.Generic.MyList`2.Foo public KeyValuePair, IEnumerable> Foo () { return new KeyValuePair, IEnumerable> (); } // IFoo members /// U generic param on MyList`2 /// M:Mono.DocTest.Generic.MyList`2.Mono#DocTest#Generic#IFoo{A}#Method``1(`0,``0). A IFoo.Method (A a, U u) { return default (A); } } }