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


C# CodeDom.CodeCommentStatement类代码示例

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


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

示例1: Constructor1_Deny_Unrestricted

		public void Constructor1_Deny_Unrestricted ()
		{
			CodeComment cc = new CodeComment ("mono");
			CodeCommentStatement ccs = new CodeCommentStatement (cc);
			Assert.AreEqual ("mono", ccs.Comment.Text, "Comment.Text");
			Assert.IsFalse (ccs.Comment.DocComment, "Comment.DocComment");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:CodeCommentStatementCas.cs

示例2: CodeGenUtil

        private CodeGenUtil()
        {
            NamespaceImports = new CodeNamespaceImport[] {
                new CodeNamespaceImport("System"),
                new CodeNamespaceImport("System.Collections.Generic"),
                new CodeNamespaceImport("System.Text"),
                new CodeNamespaceImport("Avro"),
                new CodeNamespaceImport("Avro.Specific") };

            FileComment = new CodeCommentStatement(
            @"------------------------------------------------------------------------------
             <auto-generated>
            Generated by " + System.AppDomain.CurrentDomain.FriendlyName + ", version " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version + @"
            Changes to this file may cause incorrect behavior and will be lost if code
            is regenerated
             </auto-generated>
             ------------------------------------------------------------------------------");

            // Visual Studio 2010 http://msdn.microsoft.com/en-us/library/x53a06bb.aspx
            ReservedKeywords = new HashSet<string>() {
                "abstract","as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class",
                "const", "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event",
                "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "goto", "if",
                "implicit", "in", "int", "interface", "internal", "is", "lock", "long", "namespace", "new",
                "null", "object", "operator", "out", "override", "params", "private", "protected", "public",
                "readonly", "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static",
                "string", "struct", "switch", "this", "throw", "true", "try", "typeof", "uint", "ulong",
                "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while", "value", "partial" };
        }
开发者ID:torgebo,项目名称:avro,代码行数:29,代码来源:CodeGenUtil.cs

示例3: AddRange

 /// <devdoc>
 /// <para>Copies the elements of an array to the end of the <see cref='System.CodeDom.CodeCommentStatementCollection'/>.</para>
 /// </devdoc>
 public void AddRange(CodeCommentStatement[] value) {
     if (value == null) {
         throw new ArgumentNullException("value");
     }
     for (int i = 0; ((i) < (value.Length)); i = ((i) + (1))) {
         this.Add(value[i]);
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:11,代码来源:CodeCommentStatementCollection.cs

示例4: Constructor1_NullItem

		public void Constructor1_NullItem ()
		{
			CodeCommentStatement[] statements = new CodeCommentStatement[] { 
				new CodeCommentStatement (), null };

			CodeCommentStatementCollection coll = new CodeCommentStatementCollection (
				statements);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:CodeCommentStatementCollectionTest.cs

示例5: Clone

        public static CodeCommentStatement Clone(CodeCommentStatement codestatementcol)
        {
            return new CodeCommentStatement()
            {
                Comment = Clone(codestatementcol.Comment)
                //EndDirectives =

            };
        }
开发者ID:RaptorOne,项目名称:SmartDevelop,代码行数:9,代码来源:CloneHelper.cs

示例6: TypescriptCommentStatement

 public TypescriptCommentStatement(
     IExpressionFactory expressionFactory,
     CodeCommentStatement statement,
     CodeGeneratorOptions options)
 {
     _expressionFactory = expressionFactory;
     _statement = statement;
     _options = options;
 }
开发者ID:s2quake,项目名称:TypescriptCodeDom,代码行数:9,代码来源:TypescriptCommentStatement.cs

示例7: AddRange

		public void AddRange (CodeCommentStatement [] value )
		{
			if (value == null) {
				throw new ArgumentNullException ("value");
			}

			for (int i = 0; i < value.Length; i++) {
				Add (value[i]);
			}
		}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:10,代码来源:CodeCommentStatementCollection.cs

示例8: EmitComment

        private void EmitComment(CodeCommentStatement comment)
        {
            if (string.IsNullOrEmpty(comment.Comment.Text))
                return;

            writer.Write(Parser.SingleSpace);
            writer.Write(Parser.DefaultComment);
            writer.Write(Parser.SingleSpace);
            writer.Write(comment.Comment.Text);
        }
开发者ID:Tyelpion,项目名称:IronAHK,代码行数:10,代码来源:Emit.cs

示例9: DefaultCodeCommentStatementTest

		public void DefaultCodeCommentStatementTest ()
		{
			CodeCommentStatement commentStatement = new CodeCommentStatement ();
			CodeComment comment = new CodeComment ();
			
			commentStatement.Comment = comment;
			statement = commentStatement;
			
			Generate ();
			Assertion.AssertEquals ("// \n", Code);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:11,代码来源:CodeGeneratorFromStatementTest.cs

示例10: MultiLineCodeCommentStatementTest

		public void MultiLineCodeCommentStatementTest ()
		{
			CodeCommentStatement commentStatement = new CodeCommentStatement ();
			CodeComment comment = new CodeComment ();
			
			comment.Text = "a\nb";
			commentStatement.Comment = comment;
			statement = commentStatement;
			
			Generate ();
			Assertion.AssertEquals ("// a\n//b\n", Code);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:12,代码来源:CodeGeneratorFromStatementTest.cs

示例11: Constructor1

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

			CodeCommentStatement[] statements = new CodeCommentStatement[] { ccs1, ccs2 };
			CodeCommentStatementCollection coll = new CodeCommentStatementCollection (
				statements);

			Assert.AreEqual (2, coll.Count, "#1");
			Assert.AreEqual (0, coll.IndexOf (ccs1), "#2");
			Assert.AreEqual (1, coll.IndexOf (ccs2), "#3");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:CodeCommentStatementCollectionTest.cs

示例12: Constructor2

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

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

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

示例13: CreateMember

        /// <summary>
        /// 
        /// </summary>
        /// <param name="member"></param>
        /// <param name="inner"></param>
        /// <param name="attrs"></param>
        /// <returns></returns>
        public CodeTypeMember CreateMember(MemberInfo member, CodeFieldReferenceExpression inner, MemberAttributes attrs)
        {
            Debug.Assert(member is MethodInfo);
            MethodInfo method = member as MethodInfo;
            CodeMemberMethod codeMethod = new CodeMemberMethod();

            codeMethod.Name = method.Name;
            codeMethod.ReturnType = new CodeTypeReference(method.ReturnType);
            codeMethod.Attributes = attrs;

            // try
            CodeTryCatchFinallyStatement tryCode = new CodeTryCatchFinallyStatement();

            // decleare parameters
            List<CodeArgumentReferenceExpression> codeParamiteRefrs = new List<CodeArgumentReferenceExpression>();

            foreach (ParameterInfo codeParameter in method.GetParameters()) {
                CodeParameterDeclarationExpression codeParameterDeclare = new CodeParameterDeclarationExpression(codeParameter.ParameterType, codeParameter.Name);
                codeMethod.Parameters.Add(codeParameterDeclare);
                codeParamiteRefrs.Add(new CodeArgumentReferenceExpression(codeParameter.Name));
            }

            // invoke
            CodeMethodInvokeExpression invokeMethod = new CodeMethodInvokeExpression(
                inner, method.Name, codeParamiteRefrs.ToArray());
            if (method.ReturnType.Name.ToLower() == "void") {
                tryCode.TryStatements.Add(invokeMethod);
            } else {
                CodeVariableDeclarationStatement var = new CodeVariableDeclarationStatement(method.ReturnType, "returnObject", invokeMethod);
                //CodeAssignStatement assign = new CodeAssignStatement(var, invokeMethod);
                tryCode.TryStatements.Add(var);

                CodeCommentStatement todo = new CodeCommentStatement("TODO: your code", false);
                tryCode.TryStatements.Add(todo);

                CodeVariableReferenceExpression varRef = new CodeVariableReferenceExpression("returnObject");
                CodeMethodReturnStatement codeReturn = new CodeMethodReturnStatement(varRef);
                tryCode.TryStatements.Add(codeReturn);
            }

            // catch
            CodeTypeReference codeTypeRef = new CodeTypeReference(typeof(Exception));
            CodeCatchClause catchClause = new CodeCatchClause("ex", codeTypeRef);
            catchClause.Statements.Add(new CodeThrowExceptionStatement());
            tryCode.CatchClauses.Add(catchClause);

            codeMethod.Statements.Add(tryCode);
            return codeMethod;
        }
开发者ID:yangwen27,项目名称:moonlit,代码行数:56,代码来源:MemberMethodInfoFactory.cs

示例14: IgnoreDateTimeSerializeAsString

        public static void IgnoreDateTimeSerializeAsString(CodeTypeDeclaration codeDeclTimeType)
        {
            // Remove "time" member codeattributes and add XmlIgnore
            var valueMember = codeDeclTimeType.Members.Cast<CodeTypeMember>().Where(m => m.Name == "Value").Single();
            valueMember.CustomAttributes.Clear();
            valueMember.CustomAttributes.Add(new CodeAttributeDeclaration("System.Xml.Serialization.XmlIgnore"));

            string commentLine = "New serialized string type is declared in file UBL-UnqualifiedDataTypes-2.1.partial.cs";
            CodeCommentStatement memberCommentStatement = new CodeCommentStatement(commentLine, false);
            valueMember.Comments.Add(memberCommentStatement);

            // Modify class attributes. Make it possible to step into partial class with debugger
            var debuggerStepThroughAttribute = codeDeclTimeType.CustomAttributes.OfType<CodeAttributeDeclaration>()
                .Where(a => a.Name == "System.Diagnostics.DebuggerStepThroughAttribute").SingleOrDefault();
            if (debuggerStepThroughAttribute != null)
            {
                codeDeclTimeType.CustomAttributes.Remove(debuggerStepThroughAttribute);
            }
        }
开发者ID:Gammern,项目名称:ubllarsen,代码行数:19,代码来源:XsdTimeTool.cs

示例15: Test

        /// <summary>
        /// Tests this instance.
        /// </summary>
        /// <returns>the dumped object </returns>
        public string Test()
        {
            //var element = "My String".ToCharArray().AsQueryable();
            var element = "My String".ToCharArray().Select(e => new { e, Depp = (uint)e }).AsQueryable();
            element.Dump(2);

            /*ConstantExpression blockExpr = Expression.Constant(

                Expression.Constant(42)
            );

            blockExpr.Dump(2);*/

            // TestXmlSeria();
            var testObject = new CodeTypeDeclaration("DeclClass");
            var method = new CodeMemberMethod { Name = "MyMethod" };
            testObject.Members.Add(method);
            var method2 = new CodeMemberMethod { Name = "OtherMethod" };
            testObject.Members.Add(method2);
            var comment = new CodeCommentStatement("This is a comment");
            method.Statements.Add(comment);
            var prop = new CodeMemberProperty { Name = "MyProperty", Type = new CodeTypeReference(typeof(string)) };
            testObject.Members.Add(prop);

            testObject.Dump("The description", 5);

            // var res = Extensions.Text;
            return string.Empty;

            /* var ms = new MemoryStream();
            var writer = new StreamWriter(ms);
            var swriter = new StringWriter();
            ObjectDumper.Write(testObject, int.MaxValue, swriter);
            //var xx = ms.ToString();
            var result = swriter.ToString();*/
        }
开发者ID:Jedzia,项目名称:NStub,代码行数:40,代码来源:MyObjectDumper.cs


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