Remarks() public static method

public static Remarks ( ) : IEnumerable
return IEnumerable
Exemplo n.º 1
0
        void AddEqualsDocs(CodeTypeDeclaration type, CodeMemberMethod method, int n)
        {
            var et = XmlDocs.See(DefaultNamespace, type);

            method.Comments.AddDocs(
                XmlDocs.Param("obj",
                              "A " + et + "to compare this instance against."
                              ),
                XmlDocs.Summary(
                    "  Determines whether the current instance and the specified " + et + " have the same value."
                    ),
                XmlDocs.Returns(
                    "  <para>",
                    "   <see langword=\"true\"/> if each member of <paramref name=\"obj\"/>",
                    "   and the current instance have the same value (according to",
                    "   <see cref=\"M:System.Object.Equals(System.Object)\"/>); otherwise",
                    "   <see langword=\"false\"/> is returned.",
                    "  </para>"
                    ),
                XmlDocs.Remarks(
                    "  <para>",
                    "   This method checks for value equality",
                    "   (<see cref=\"M:System.Object.Equals(System.Object)\"/>), as defined by each",
                    "   value type.",
                    "  </para>"
                    )
                );
        }
Exemplo n.º 2
0
        void AddCreatorDocs(CodeTypeDeclaration type, CodeMemberMethod method, int w, int n)
        {
            var tp   = Types.GetTypeParameter(w, n);
            var idx  = XmlDocs.GetIndex(tp);
            var fold = type.GetMethods("Fold").First();

            method.Comments.AddDocs(
                XmlDocs.Param("value",
                              "  A <typeparamref name=\"" + tp + "\" /> containing the value",
                              "  to provide to the " + idx,
                              "  " + XmlDocs.See(DefaultNamespace, type, fold),
                              "  delegate."
                              ),
                XmlDocs.Summary(
                    "  Creates a " + XmlDocs.See(DefaultNamespace, type) + " instance which",
                    "  holds a <typeparamref name=\"" + tp + "\" /> value."
                    ),
                XmlDocs.Returns(
                    "  A " + XmlDocs.See(DefaultNamespace, type) + " instance which holds a ",
                    "  holds a <typeparamref name=\"" + tp + "\" /> value."
                    ),
                XmlDocs.Remarks(
                    "  <para>",
                    "   When",
                    "   " + XmlDocs.See(DefaultNamespace, type, fold),
                    "   is invoked,",
                    "   the returned " + XmlDocs.See(DefaultNamespace, type) + " instance",
                    "   will invoke the " + idx + " delegate",
                    "   for conversions.",
                    "  </para>"
                    ),
                XmlDocs.ArgumentNullException("value")
                );
        }
Exemplo n.º 3
0
 void AddFoldDocs(CodeTypeDeclaration type, CodeMemberMethod method, int n)
 {
     method.Comments.AddDocs(
         XmlDocs.TypeParam("TResult",
                           "  The type to convert the " + XmlDocs.See(DefaultNamespace, type) + " to."
                           ),
         GetFoldParametersDocs(type, n),
         XmlDocs.Summary(
             "  Converts a " + XmlDocs.See(DefaultNamespace, type) + " into a <typeparamref name=\"TResult\" /> value."
             ),
         XmlDocs.Returns(
             "  A <typeparamref name=\"TResult\" /> as generated by one",
             "  of the conversion delegate parameters."
             ),
         XmlDocs.Remarks(
             "  <para>",
             "   Converts a " + XmlDocs.See(DefaultNamespace, type) + " into a <typeparamref name=\"TResult\" />",
             "   by invoking one of the provided delegate parameters.",
             "  </para>",
             "  <para>",
             "   The parameter which is invoked is predicated upon the internal position of",
             "   the value held.  For example, if the internal value is in the first position ",
             "   (i.e. " + XmlDocs.See(DefaultNamespace, type, type.GetMethods(A(0)).First()),
             "   was used to create the " + XmlDocs.See(DefaultNamespace, type) + " instance), then",
             "   <paramref name=\"a\" /> (the first delegate parameter) will be invoked to",
             "   convert the <typeparamref name=\"T1\" /> into a ",
             "   <typeparamref name=\"TResult\" />.",
             "  </para>"
             ),
         XmlDocs.ArgumentNullException(Enumerable.Range(0, n).Select(v => a(v)))
         );
 }
Exemplo n.º 4
0
 void AddGetHashCodeDocs(CodeTypeDeclaration type, CodeMemberMethod method, int n)
 {
     method.Comments.AddDocs(
         XmlDocs.Summary("  Generates a hash code for the current instance."),
         XmlDocs.Returns("  A <see cref=\"T:System.Int32\"/> containing the hash code for this instance."),
         XmlDocs.Remarks(
             "  <para>",
             "   <block subset=\"none\" type=\"note\">",
             "    This method overrides <see cref=\"M:System.Object.GetHashCode\"/>.",
             "   </block>",
             "  </para>"
             )
         );
 }
Exemplo n.º 5
0
        static CodeMemberMethod RecFunc(int args)
        {
            var t = Types.Func(args);
            var m = new CodeMemberMethod()
            {
                Attributes = MemberAttributes.Static | MemberAttributes.Public,
                Name       = "RecFunc",
                ReturnType = t,
            };

            m.TypeParameters.AddRange(Types.GetTypeParameters(args, true).ToArray());
            var a = "lambda";

            m.Parameters.Add(new CodeParameterDeclarationExpression(new CodeTypeReference("Func", t, t), a));
            m.Statements.ThrowWhenArgumentIsNull(a);
            var expr = AppendArgs(new StringBuilder(), args);

            expr.Append(" => lambda (RecFunc (lambda))");
            AppendArgs(expr, args);
            m.Statements.Add(new CodeMethodReturnStatement(new CodeSnippetExpression(expr.ToString())));
            m.Comments.AddRange("From: http://blogs.msdn.com/madst/archive/2007/05/11/recursive-lambda-expressions.aspx");
            m.Comments.AddDocs(
                XmlDocs.TypeParams(m.TypeParameters, t),
                XmlDocs.Param("lambda", "The " + XmlDocs.See(t) + " to use."),
                XmlDocs.Summary("Creates a " + XmlDocs.See(t) + " delegate, which may be recursive."),
                XmlDocs.Returns("Returns a " + XmlDocs.See(t) + " which (eventually) invokes <paramref name=\"lambda\"/>."),
                XmlDocs.ArgumentNullException("lambda"),
                XmlDocs.Remarks(
                    "<para>",
                    "  The following example makes use of a recursive lambda:",
                    "</para>",
                    "<code lang=\"C#\">",
                    "  Func<int, int> factorial = Lambda.RecFunc<int, int> (".Replace("<", "&lt;"),
                    "      fac => x => x == 0 ? 1 : x * fac (x-1));",
                    "  Console.WriteLine (factorial (5));  // prints \"120\"",
                    "</code>"
                    )
                );
            return(m);
        }