Mono.Rocks.Tools.XmlDocs.GetIndex C# (CSharp) Method

GetIndex() public static method

public static GetIndex ( string name ) : string
name string
return string
        public static string GetIndex(string name)
        {
            if (name.Length == 1)
                name = "T1";
            name = name.Substring (1);
            switch (name) {
                case "1": return "first";
                case "2": return "second";
                case "3": return "third";
                case "4": return "fourth";
            }
            return "*unknown*";
        }

Usage Example

Example #1
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")
                );
        }