当前位置: 首页>>代码示例>>C#>>正文


C# CodeCommentStatementCollection.Add方法代码示例

本文整理汇总了C#中System.CodeDom.CodeCommentStatementCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# CodeCommentStatementCollection.Add方法的具体用法?C# CodeCommentStatementCollection.Add怎么用?C# CodeCommentStatementCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.CodeDom.CodeCommentStatementCollection的用法示例。


在下文中一共展示了CodeCommentStatementCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateSummaryComment

 /// <summary>
 /// Add to CodeCommentStatementCollection summary documentation
 /// </summary>
 /// <param name="codeStatmentColl">Collection of CodeCommentStatement</param>
 /// <param name="comment">summary text</param>
 internal static void CreateSummaryComment(CodeCommentStatementCollection codeStatmentColl, string comment)
 {
     codeStatmentColl.Add(new CodeCommentStatement("<summary>", true));
     string[] lines = comment.Split(new[] { '\n' });
     foreach (string line in lines)
         codeStatmentColl.Add(new CodeCommentStatement(line.Trim(), true));
     codeStatmentColl.Add(new CodeCommentStatement("</summary>", true));
 }
开发者ID:flonou,项目名称:xsd2code,代码行数:13,代码来源:CodeDomHelper.cs

示例2: Clone

 public static CodeCommentStatementCollection Clone(CodeCommentStatementCollection codestatementcol)
 {
     var col = new CodeCommentStatementCollection();
     foreach(CodeCommentStatement cstat in codestatementcol) {
         col.Add(Clone(cstat));
     }
     return col;
 }
开发者ID:RaptorOne,项目名称:SmartDevelop,代码行数:8,代码来源:CloneHelper.cs

示例3: Constructor1_Deny_Unrestricted

		public void Constructor1_Deny_Unrestricted ()
		{
			CodeCommentStatementCollection coll = new CodeCommentStatementCollection (array);
			coll.CopyTo (array, 0);
			Assert.AreEqual (1, coll.Add (ccs), "Add");
			Assert.AreSame (ccs, coll[0], "this[int]");
			coll.AddRange (array);
			coll.AddRange (coll);
			Assert.IsTrue (coll.Contains (ccs), "Contains");
			Assert.AreEqual (0, coll.IndexOf (ccs), "IndexOf");
			coll.Insert (0, ccs);
			coll.Remove (ccs);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:CodeCommentStatementCollectionCas.cs

示例4: AddWarningComment

 internal static void AddWarningComment(CodeCommentStatementCollection comments, string text) {
     Debug.Assert(comments != null);
     comments.Add(new CodeCommentStatement(Res.GetString(Res.XmlCodegenWarningDetails, text), false));
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:4,代码来源:CodeExporter.cs

示例5: EmitXmlComments

        /// <summary>
        /// emit documentation comments between xml open and close tags
        /// </summary>
        /// <param name="tag">the xml tag name</param>
        /// <param name="summaryComments">the lines of comments to emit</param>
        /// <param name="commentCollection">the comment collection of the CodeDom object to be commented</param>
        private static void EmitXmlComments(string tag, string[] summaryComments, CodeCommentStatementCollection commentCollection)
        {
            Debug.Assert(tag != null);
            Debug.Assert(summaryComments != null);
            Debug.Assert(commentCollection != null);

            commentCollection.Add(new CodeCommentStatement(string.Format(CultureInfo.InvariantCulture, "<{0}>", tag), true));
            EmitComments(summaryComments, commentCollection, true);
            commentCollection.Add(new CodeCommentStatement(string.Format(CultureInfo.InvariantCulture, "</{0}>", tag), true));
        }
开发者ID:uQr,项目名称:referencesource,代码行数:16,代码来源:CommentEmitter.cs

示例6: EmitComments

        /// <summary>
        /// Emit some lines of comments
        /// </summary>
        /// <param name="commentLines">the lines of comments to emit</param>
        /// <param name="commentCollection">the comment collection of the CodeDom object to be commented</param>
        /// <param name="docComment">true if the comments are 'documentation' comments</param>
        public static void EmitComments(string[] commentLines, CodeCommentStatementCollection commentCollection, bool docComment)
        {
            Debug.Assert(commentLines != null, "commentLines parameter is null");
            Debug.Assert(commentCollection != null, "commentCollection parameter is null");

            foreach (string comment in commentLines)
            {
                commentCollection.Add(new CodeCommentStatement(comment, docComment));
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:16,代码来源:CommentEmitter.cs

示例7: Remove

		public void Remove ()
		{
			CodeCommentStatement ccs1 = new CodeCommentStatement ();
			CodeCommentStatement ccs2 = new CodeCommentStatement ();

			CodeCommentStatementCollection coll = new CodeCommentStatementCollection ();
			coll.Add (ccs1);
			coll.Add (ccs2);
			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (ccs1), "#2");
			Assert.AreEqual (1, coll.IndexOf (ccs2), "#3");
			coll.Remove (ccs1);
			Assert.AreEqual (1, coll.Count, "#4");
			Assert.AreEqual (-1, coll.IndexOf (ccs1), "#5");
			Assert.AreEqual (0, coll.IndexOf (ccs2), "#6");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:16,代码来源:CodeCommentStatementCollectionTest.cs

示例8: AddRange

		public void AddRange ()
		{
			CodeCommentStatement ccs1 = new CodeCommentStatement ();
			CodeCommentStatement ccs2 = new CodeCommentStatement ();
			CodeCommentStatement ccs3 = new CodeCommentStatement ();

			CodeCommentStatementCollection coll1 = new CodeCommentStatementCollection ();
			coll1.Add (ccs1);
			coll1.Add (ccs2);

			CodeCommentStatementCollection coll2 = new CodeCommentStatementCollection ();
			coll2.Add (ccs3);
			coll2.AddRange (coll1);
			Assert.AreEqual (3, coll2.Count, "#1");
			Assert.AreEqual (1, coll2.IndexOf (ccs1), "#2");
			Assert.AreEqual (2, coll2.IndexOf (ccs2), "#3");
			Assert.AreEqual (0, coll2.IndexOf (ccs3), "#4");

			CodeCommentStatementCollection coll3 = new CodeCommentStatementCollection ();
			coll3.Add (ccs3);
			coll3.AddRange (new CodeCommentStatement[] { ccs1, ccs2 });
			Assert.AreEqual (3, coll2.Count, "#5");
			Assert.AreEqual (1, coll2.IndexOf (ccs1), "#6");
			Assert.AreEqual (2, coll2.IndexOf (ccs2), "#7");
			Assert.AreEqual (0, coll2.IndexOf (ccs3), "#8");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:26,代码来源:CodeCommentStatementCollectionTest.cs

示例9: InsertDocumentation

        private CodeCommentStatementCollection InsertDocumentation(Documetation type, string[] text)
        {
            CodeCommentStatementCollection comments = new CodeCommentStatementCollection();

            switch (type)
            {
                case Documetation.Remarks:
                    comments.Add(new CodeCommentStatement("<remarks>", true));
                    break;
                case Documetation.Summary:
                    comments.Add(new CodeCommentStatement("<summary>", true));
                    break;
                case Documetation.Example:
                    comments.Add(new CodeCommentStatement("<example>", true));
                    break;
                case Documetation.Exception:
                    comments.Add(new CodeCommentStatement("<exception>", true));
                    break;
                case Documetation.Param:
                    comments.Add(new CodeCommentStatement("<param>", true));
                    break;
                case Documetation.Permission:
                    comments.Add(new CodeCommentStatement("<permission>", true));
                    break;
                case Documetation.Returns:
                    comments.Add(new CodeCommentStatement("<returns>", true));
                    break;
                case Documetation.SeeAlso:
                    foreach (string comment in text)
                        comments.Add(new CodeCommentStatement("<seealso cref=\"" + comment + "\" />", true));
                    return comments;
                case Documetation.Include:
                    comments.Add(new CodeCommentStatement("<include>", true));
                    break;
                default:
                    break;
            }

            foreach (string comment in text)
                comments.Add(new CodeCommentStatement(comment, (null != type)));

            switch (type)
            {
                case Documetation.Remarks:
                    comments.Add(new CodeCommentStatement("</remarks>", true));
                    break;
                case Documetation.Summary:
                    comments.Add(new CodeCommentStatement("</summary>", true));
                    break;
                case Documetation.Example:
                    comments.Add(new CodeCommentStatement("</example>", true));
                    break;
                case Documetation.Exception:
                    comments.Add(new CodeCommentStatement("</exception>", true));
                    break;
                case Documetation.Param:
                    comments.Add(new CodeCommentStatement("</param>", true));
                    break;
                case Documetation.Permission:
                    comments.Add(new CodeCommentStatement("</permission>", true));
                    break;
                case Documetation.Returns:
                    comments.Add(new CodeCommentStatement("</returns>", true));
                    break;
                case Documetation.Include:
                    comments.Add(new CodeCommentStatement("</include>", true));
                    break;
                default:
                    break;
            }

            return comments;
        }
开发者ID:MonoBrasil,项目名称:CsDO,代码行数:73,代码来源:EntityGenerator.Common.cs

示例10: SplitCommentLines

 private static CodeCommentStatementCollection SplitCommentLines(string comment)
 {
     var lines = Regex.Split(comment, "[\r\n]+");
     var result = new CodeCommentStatementCollection();
     lines.ToList<String>().ConvertAll(c => new CodeCommentStatement(c, true)).ForEach(c => result.Add(c));
     return result;
 }
开发者ID:RandoriAS,项目名称:randori-tools,代码行数:7,代码来源:Program.cs

示例11: CreateCommentsAndObjectsForFunctionArguments

 private static void CreateCommentsAndObjectsForFunctionArguments(CodeMemberField member, XElement elm)
 {
     var args = elm.Elements("argument").ToList<XElement>();
     member.Comments.Add(new CodeCommentStatement("<br/>The signature of this function needs to be as follows:<br/>", true));
     var comment = "Function(";
     var idx = 0;
     var descriptions = new CodeCommentStatementCollection();
     descriptions.Add(new CodeCommentStatement("<ul>", true));
     var references = new CodeCommentStatementCollection();
     foreach (var arg in args)
     {
         if (idx++ > 0)
         {
             comment += ", ";
         }
         var type = "";
         if ((arg.Attribute("type").Value == "PlainObject") && (arg.Elements("property").Count() > 0))
         {
             type = CreateTypedObjectForPlainObject(arg.Attribute("name").Value, arg);
             references.Add(new CodeCommentStatement("@see randori.jquery." + type, true));
         }
         else
         {
             type = TranslateType(arg.Attribute("type").Value);
         }
         comment += arg.Attribute("name").Value + ":" + type;
         descriptions.Add(new CodeCommentStatement("<li>" + arg.Attribute("name").Value + ":" + type + " - " + arg.Element("desc").Value + "<li/>", true));
     }
     descriptions.Add(new CodeCommentStatement("</ul>", true));
     comment += "):void;";
     member.Comments.Add(new CodeCommentStatement(comment, true));
     member.Comments.AddRange(descriptions);
     ((CodeCommentStatementCollection)member.UserData["references"]).AddRange(references);
 }
开发者ID:RandoriAS,项目名称:randori-tools,代码行数:34,代码来源:Program.cs

示例12: GenerateErrorString

		public static string GenerateErrorString(Exception ex, CodeDomProvider codeProvider, string fileName, string baseNamespace)
		{
			CodeGeneratorOptions gen = new CodeGeneratorOptions();
			gen.BracingStyle = "C";
			gen.IndentString = "\t";
			gen.VerbatimOrder = true;
			gen.BlankLinesBetweenMembers = false;

			CodeCommentStatementCollection comments = new CodeCommentStatementCollection();
			GenerateHeader(comments, fileName, baseNamespace);

			if (ex is CompileException)
			{
				CompileException cx = (CompileException)ex;
				comments.Add(new CodeCommentStatement(string.Format("Error generating shader:{0}{1} (line: {2} col: {3})", Environment.NewLine, cx.Text, cx.Line, cx.Coloumn)));
			}
			else if (ex is CompileExceptionCollection)
			{
				CompileExceptionCollection cxc = (CompileExceptionCollection)ex;
				for (int i = 0; i < cxc.Count; i++)
				{
					CompileException cx = cxc.GetException(i);
					comments.Add(new CodeCommentStatement(string.Format("Error generating shader:{0}{1} (line: {2} col: {3})", Environment.NewLine, cx.Text, cx.Line, cx.Coloumn)));
				}
			}
			else
			{
				comments.Add(new CodeCommentStatement(string.Format("Unhandled exception in XenFX:{0}{1}", Environment.NewLine, ex.ToString())));
			}
			
			StringBuilder sb = new StringBuilder();
			using (TextWriter writer = new StringWriter(sb))
			{
				foreach (CodeCommentStatement comment in comments)
				{
					codeProvider.GenerateCodeFromStatement(comment, writer, gen);
				}
			}
			return sb.ToString();
		}
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:40,代码来源:Dom.cs

示例13: Rewrite

 protected void Rewrite(CodeCommentStatementCollection target, CodeCommentStatementCollection source, ref bool didRewrite)
 {
     foreach (CodeCommentStatement item in source)
     {
         target.Add(this.Rewrite(item, ref didRewrite));
     }
 }
开发者ID:AlineGuan,项目名称:odata.net,代码行数:7,代码来源:CodeDomTreeRewriter.cs

示例14: GenerateSummaryComment

        /// <summary>
        /// Generates a summary comment.
        /// </summary>
        /// <param name="comments">Comments collection to add the comments to.</param>
        /// <param name="content">Content of the comment.</param>
        private static void GenerateSummaryComment(CodeCommentStatementCollection comments, string content)
        {
            comments.Add(new CodeCommentStatement("<summary>", true));

            string nextComment;
            int newlineIndex = content.IndexOf(Environment.NewLine);
            int offset = 0;
            while (newlineIndex != -1)
            {
                nextComment = content.Substring(offset, newlineIndex - offset).Trim();
                comments.Add(new CodeCommentStatement(nextComment, true));
                offset = newlineIndex + Environment.NewLine.Length;
                newlineIndex = content.IndexOf(Environment.NewLine, offset);
            }
            nextComment = content.Substring(offset).Trim();
            comments.Add(new CodeCommentStatement(nextComment, true));

            comments.Add(new CodeCommentStatement("</summary>", true));
        }
开发者ID:sillsdev,项目名称:FwSupportTools,代码行数:24,代码来源:StronglyTypedClasses.cs

示例15: GetDocComments

        /// <summary>
        /// Takes a multi-line comment defined in a resource file and correctly formats it as a doc comment
        /// for use in code-dom.
        /// </summary>
        /// <param name="resourceComment">The comment to format as a doc comment. This cannot be null.</param>
        /// <param name="isCSharp">Whether or not the doc comment is for C#.</param>
        /// <returns>A collection of comment statements that matches the input resource</returns>
        internal static CodeCommentStatementCollection GetDocComments(string resourceComment, bool isCSharp)
        {
            if (resourceComment == null)
            {
                throw new ArgumentNullException("resourceComment");
            }

            CodeCommentStatementCollection commentCollection = new CodeCommentStatementCollection();
            foreach (string comment in resourceComment.Split(new string[] { Environment.NewLine }, StringSplitOptions.None))
            {
                // VB needs to have a prefixing space before each comment, to ensure the ''' XML comments are properly marked
                // Otherwise a comment that starts with a single quote will be broken (build warnings).
                commentCollection.Add(new CodeCommentStatement((isCSharp ? comment : ' ' + comment), true));
            }
            return commentCollection;
        }
开发者ID:OpenRIAServices,项目名称:OpenRiaServices,代码行数:23,代码来源:CodeGenUtilities.cs


注:本文中的System.CodeDom.CodeCommentStatementCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。