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


C# SyntaxWriter.WriteLine方法代码示例

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


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

示例1: WriteDelegateSyntax

        public override void WriteDelegateSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {

            string name = (string)reflection.Evaluate(apiNameExpression);
            bool isSerializable = (bool)reflection.Evaluate(apiIsSerializableTypeExpression);

            if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);

            WriteAttributes(reflection, writer);

            writer.WriteKeyword("type");
            writer.WriteString(" ");
            writer.WriteIdentifier(name);
            writer.WriteString(" = ");
            writer.WriteLine();
            writer.WriteString("    ");
            writer.WriteKeyword("delegate");
            writer.WriteString(" ");
            writer.WriteKeyword("of");
            writer.WriteString(" ");

            WriteParameters(reflection, writer);

            writer.WriteKeyword("->");
            writer.WriteString(" ");
            WriteReturnValue(reflection, writer);

        }
开发者ID:jongalloway,项目名称:dotnetopenid,代码行数:28,代码来源:FSharpDeclarationSyntax.cs

示例2: WriteNormalMethodSyntax

		public override void WriteNormalMethodSyntax (XPathNavigator reflection, SyntaxWriter writer) {
            if (IsUnsupportedVarargs(reflection, writer)) return;

			string name = (string) reflection.Evaluate(apiNameExpression);
			XPathNavigator type = reflection.SelectSingleNode(apiReturnTypeExpression);
			bool isExplicit = (bool) reflection.Evaluate(apiIsExplicitImplementationExpression);

			WriteAttributes(reflection, writer);
			WriteProcedureModifiers(reflection, writer);
			if (type == null) {
				writer.WriteKeyword("Sub");
			} else {
				writer.WriteKeyword("Function");
			}
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
			WriteGenericTemplates(reflection, writer);
			WriteParameters(reflection, writer);
			if (type != null) {
				writer.WriteString(" ");
				writer.WriteKeyword("As");
				writer.WriteString(" ");
				WriteTypeReference(type, writer);
			}
			if (isExplicit) {
                if (writer.Position > maxPosition) {
                    writer.WriteLine();
                    writer.WriteString("\t");
                } else {
                    writer.WriteString(" ");
                }
                writer.WriteKeyword("Implements");
				writer.WriteString(" ");
				XPathNodeIterator implementations = reflection.Select(apiImplementedMembersExpression);
				while (implementations.MoveNext()) {
					XPathNavigator implementation = implementations.Current;
					XPathNavigator contract = implementation.SelectSingleNode(attributeTypeExpression);
					// string id = implementation.GetAttribute("api", String.Empty);
					if (implementations.CurrentPosition > 1) writer.WriteString(", ");
					WriteTypeReference(contract, writer);
					writer.WriteString(".");
                    WriteMemberReference(implementation, writer);
				}
			}

		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:46,代码来源:VisualBasicDeclarationSyntax.cs

示例3: WriteAttributes

        // Initial version
        private void WriteAttributes(XPathNavigator reflection, SyntaxWriter writer)
        {

            XPathNodeIterator attributes = (XPathNodeIterator)reflection.Evaluate(apiAttributesExpression);

            foreach (XPathNavigator attribute in attributes)
            {

                XPathNavigator type = attribute.SelectSingleNode(attributeTypeExpression);
                if (type.GetAttribute("api", String.Empty) == "T:System.Runtime.CompilerServices.ExtensionAttribute") continue;

                writer.WriteString("[<");
                WriteTypeReference(type, writer);

                XPathNodeIterator arguments = (XPathNodeIterator)attribute.Select(attributeArgumentsExpression);
                XPathNodeIterator assignments = (XPathNodeIterator)attribute.Select(attributeAssignmentsExpression);

                if ((arguments.Count > 0) || (assignments.Count > 0))
                {
                    writer.WriteString("(");
                    while (arguments.MoveNext())
                    {
                        XPathNavigator argument = arguments.Current;
                        if (arguments.CurrentPosition > 1)
                        {
                            writer.WriteString(", ");
                            if (writer.Position > maxPosition)
                            {
                                writer.WriteLine();
                                writer.WriteString("    ");
                            }
                        }
                        WriteValue(argument, writer);
                    }
                    if ((arguments.Count > 0) && (assignments.Count > 0)) writer.WriteString(", ");
                    while (assignments.MoveNext())
                    {
                        XPathNavigator assignment = assignments.Current;
                        if (assignments.CurrentPosition > 1)
                        {
                            writer.WriteString(", ");
                            if (writer.Position > maxPosition)
                            {
                                writer.WriteLine();
                                writer.WriteString("    ");
                            }
                        }
                        writer.WriteString((string)assignment.Evaluate(assignmentNameExpression));
                        writer.WriteString(" = ");
                        WriteValue(assignment, writer);

                    }
                    writer.WriteString(")");
                }

                writer.WriteString(">]");
                writer.WriteLine();
            }

        }
开发者ID:jongalloway,项目名称:dotnetopenid,代码行数:61,代码来源:FSharpDeclarationSyntax.cs

示例4: WriteNormalMethodSyntax

        public override void WriteNormalMethodSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {

            string name = (string)reflection.Evaluate(apiNameExpression);
            bool isOverride = (bool)reflection.Evaluate(apiIsOverrideExpression);
            bool isStatic = (bool)reflection.Evaluate(apiIsStaticExpression);
            bool isVirtual = (bool)reflection.Evaluate(apiIsVirtualExpression) && !(bool)reflection.Evaluate(apiIsAbstractProcedureExpression);
            int iterations = isVirtual ? 2 : 1;

            for (int i = 0; i < iterations; i++)
            {

                WriteAttributes(reflection, writer);

                WriteVisibility(reflection, writer);

                if (isStatic)
                {
                    writer.WriteKeyword("static");
                    writer.WriteString(" ");
                }

                if (isVirtual)
                    if (i == 0)
                    {
                        writer.WriteKeyword("abstract");
                        writer.WriteString(" ");
                    }
                    else
                    {
                        writer.WriteKeyword("override");
                        writer.WriteString(" ");
                    }
                else
                {
                    WriteMemberKeyword(reflection, writer);
                }
 
                writer.WriteIdentifier(name);
                writer.WriteString(" : ");
                WriteParameters(reflection, writer);
                writer.WriteKeyword("->");
                writer.WriteString(" ");
                WriteReturnValue(reflection, writer);
                writer.WriteString(" ");
                WriteGenericTemplateConstraints(reflection, writer);

                if (i == 0)
                    writer.WriteLine();
            }
        }
开发者ID:jongalloway,项目名称:dotnetopenid,代码行数:51,代码来源:FSharpDeclarationSyntax.cs

示例5: WriteEventSyntax

        public override void WriteEventSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            string name = (string)reflection.Evaluate(apiNameExpression);
            XPathNavigator handler = reflection.SelectSingleNode(apiHandlerOfEventExpression);
            XPathNavigator args = reflection.SelectSingleNode(apiEventArgsExpression);
            bool isVirtual = (bool)reflection.Evaluate(apiIsVirtualExpression) && !(bool)reflection.Evaluate(apiIsAbstractProcedureExpression);
            int iterations = isVirtual ? 2 : 1;

            for (int i = 0; i < iterations; i++)
            {
                WriteAttributes(reflection, writer);
                WriteVisibility(reflection, writer);
                if (isVirtual)
                    if (i == 0)
                    {
                        writer.WriteKeyword("abstract");
                        writer.WriteString(" ");
                    }
                    else
                    {
                        writer.WriteKeyword("override");
                        writer.WriteString(" ");
                    }
                else
                {
                    WriteMemberKeyword(reflection, writer);
                }
                writer.WriteIdentifier(name);
                writer.WriteString(" : ");
                writer.WriteReferenceLink("T:Microsoft.FSharp.Control.IEvent");

                writer.WriteString("<");
                WriteTypeReference(handler, writer);
                writer.WriteString(",");
                writer.WriteLine();
                writer.WriteString("    ");
                if (args == null)
                {
                    writer.WriteReferenceLink("T:System.EventArgs");
                }
                else
                {
                    WriteTypeReference(args, writer);
                }
                writer.WriteString(">");
                if (i == 0)
                    writer.WriteLine();
            }
        }
开发者ID:jongalloway,项目名称:dotnetopenid,代码行数:49,代码来源:FSharpDeclarationSyntax.cs

示例6: WritePropertyParameters

		private void WritePropertyParameters (XPathNavigator reflection, SyntaxWriter writer) {

			XPathNodeIterator parameters = reflection.Select(apiParametersExpression);

			if (parameters.Count == 0) return;

			writer.WriteString("[");
			writer.WriteLine();
			WriteParameters(parameters, reflection, writer);
			writer.WriteString("]");

		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:12,代码来源:CSharpDeclarationSyntax.cs

示例7: ObjectElementUsageForClassStruct

        private void ObjectElementUsageForClassStruct(XPathNavigator reflection, SyntaxWriter writer)
        {
            string typeName = (string)reflection.Evaluate(apiNameExpression);
            bool isGeneric = (bool)reflection.Evaluate(apiIsGenericExpression);
            string xamlBlockId = System.Enum.GetName(typeof(XamlHeadingID), XamlHeadingID.xamlObjectElementUsageHeading);

            string contentPropertyId = (string)reflection.Evaluate(contentPropertyIdExpression);
            if (contentPropertyId == "")
                contentPropertyId = (string)reflection.Evaluate(ancestorContentPropertyIdExpression);

            // start the syntax block
            writer.WriteStartSubBlock(xamlBlockId);

            writer.WriteString("<");
            if (isGeneric)
            {
                writer.WriteIdentifier(typeName);

                // for generic types show the type arguments
                XPathNodeIterator templates = (XPathNodeIterator)reflection.Evaluate(apiTemplatesExpression);
                if (templates.Count > 0)
                {
                    writer.WriteString(" x:TypeArguments=\"");
                    while (templates.MoveNext())
                    {
                        XPathNavigator template = templates.Current;
                        string name = template.GetAttribute("name", String.Empty);
                        writer.WriteString(name);
                        if (templates.CurrentPosition < templates.Count)
                            writer.WriteString(",");
                    }
                    writer.WriteString("\"");
                }
            }
            else
            {
                // for non-generic types just show the name
                writer.WriteIdentifier(typeName);
            }
            if (contentPropertyId == string.Empty)
            {
                writer.WriteString(" .../>");
            }
            else
            {
                // close the start tag
                writer.WriteString(">");

                // the inner xml of the Object Element syntax for a type with a content property
                // is a link to the content property
                writer.WriteLine();
                writer.WriteString("  ");
                writer.WriteReferenceLink(contentPropertyId);
                writer.WriteLine();

                // write the end tag
                writer.WriteString("</");
                writer.WriteIdentifier(typeName);
                writer.WriteString(">");
            }

            // end the sub block
            writer.WriteEndSubBlock();
        }
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:64,代码来源:XamlUsageSyntax.cs

示例8: WriteParameters

		// Parameters

		private void WriteParameters (XPathNavigator reflection, SyntaxWriter writer) {

			XPathNodeIterator parameters = reflection.Select(apiParametersExpression);
			if (parameters.Count == 0) return;

			writer.WriteString(" ( _");
			writer.WriteLine();
			while (parameters.MoveNext()) {
				XPathNavigator parameter = parameters.Current;
				XPathNavigator type = parameter.SelectSingleNode(parameterTypeExpression);
				string name = (string) parameter.Evaluate(parameterNameExpression);
				bool isIn = (bool) parameter.Evaluate(parameterIsInExpression);
				bool isOut = (bool) parameter.Evaluate(parameterIsOutExpression);
				bool isParamArray = (bool) parameter.Evaluate(parameterIsParamArrayExpression);
				bool isByRef = (bool) parameter.Evaluate(parameterIsRefExpression);

				writer.WriteString("\t");
				if (isOut) {
					WriteAttribute("T:System.Runtime.InteropServices.OutAttribute", false, writer);
					writer.WriteString(" ");
				}
				if (isParamArray) {
					writer.WriteKeyword("ParamArray");
					writer.WriteString(" ");
				}
				if (isByRef) {
					writer.WriteKeyword("ByRef");
					writer.WriteString(" ");
				}
				writer.WriteParameter(name);
				writer.WriteString(" ");
				writer.WriteKeyword("As");
				writer.WriteString(" ");
				WriteTypeReference(type, writer);
				if (parameters.CurrentPosition < parameters.Count) writer.WriteString(",");
				writer.WriteString(" _");
				writer.WriteLine();
			}
			writer.WriteString(")");

		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:43,代码来源:VisualBasicDeclarationSyntax.cs

示例9: WriteDelegateSyntax

		public override void WriteDelegateSyntax (XPathNavigator reflection, SyntaxWriter writer) {

			if (IsUnsupportedUnsafe(reflection, writer)) return;
			if (IsUnsupportedGeneric(reflection, writer)) return;

			string name = (string) reflection.Evaluate(apiNameExpression);
			bool isSerializable = (bool) reflection.Evaluate(apiIsSerializableTypeExpression);

			writer.WriteString("/** @delegate */");
			writer.WriteLine();

			if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);
			WriteAttributes(reflection, writer);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			writer.WriteKeyword("delegate");
			writer.WriteString(" ");
			WriteReturnValue(reflection, writer);
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
			WriteMethodParameters(reflection, writer);
			
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:23,代码来源:JSharpDeclarationSyntax.cs

示例10: WriteBaseClass

		// Interfaces

		private void WriteBaseClass (XPathNavigator reflection, SyntaxWriter writer) {

			XPathNavigator baseClass = reflection.SelectSingleNode(apiBaseClassExpression);

			if ((baseClass != null) && !((bool) baseClass.Evaluate(typeIsObjectExpression))) {
				writer.WriteString(" _");
				writer.WriteLine();
				writer.WriteString("\t");
				writer.WriteKeyword("Inherits");
				writer.WriteString(" ");
				WriteTypeReference(baseClass, writer);
			}

		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:16,代码来源:VisualBasicDeclarationSyntax.cs

示例11: WriteImplementedInterfaces

		private void WriteImplementedInterfaces (XPathNavigator reflection, SyntaxWriter writer) {

			XPathNodeIterator implements = reflection.Select(apiImplementedInterfacesExpression);

			if (implements.Count == 0) return;

			writer.WriteString(" _");
			writer.WriteLine();
			writer.WriteString("\t");
            string subgroup = (string)reflection.Evaluate(apiSubgroupExpression);
            if (subgroup == "interface")
                writer.WriteKeyword("Inherits");
            else
                writer.WriteKeyword("Implements");
            writer.WriteString(" ");
			while (implements.MoveNext()) {
				XPathNavigator implement = implements.Current;
                if (implements.CurrentPosition > 1) {
                    writer.WriteString(", ");
                    if (writer.Position > maxPosition) {
                        writer.WriteString(" _");
                        writer.WriteLine();
                        writer.WriteString("\t");
                    }
                }
				WriteTypeReference(implement, writer);
			}

		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:29,代码来源:VisualBasicDeclarationSyntax.cs

示例12: WriteAttribute

		private void WriteAttribute (string reference, bool newLine, SyntaxWriter writer) {
			writer.WriteString("<");
			writer.WriteReferenceLink(reference);
			writer.WriteString(">");
			if (newLine) {
				writer.WriteString(" _");
				writer.WriteLine();
			}
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:9,代码来源:VisualBasicDeclarationSyntax.cs

示例13: WriteExplicitImplementations

 private void WriteExplicitImplementations (XPathNavigator reflection, SyntaxWriter writer) {
     bool isExplicit = (bool)reflection.Evaluate(apiIsExplicitImplementationExpression);
     if (isExplicit) {
         if (writer.Position > maxPosition) {
             writer.WriteLine();
             writer.WriteString("\t");
         } else {
             writer.WriteString(" ");
         }
         writer.WriteKeyword("Implements");
         writer.WriteString(" ");
         XPathNodeIterator implementations = reflection.Select(apiImplementedMembersExpression);
         while (implementations.MoveNext()) {
             XPathNavigator implementation = implementations.Current;
             XPathNavigator contract = implementation.SelectSingleNode(memberDeclaringTypeExpression);
             //string id = implementation.GetAttribute("api", String.Empty);
             if (implementations.CurrentPosition > 1) writer.WriteString(", ");
             WriteTypeReference(contract, writer);
             writer.WriteString(".");
             WriteMemberReference(implementation, writer);
             //writer.WriteReferenceLink(id);	
         }
     }
 }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:24,代码来源:VisualBasicDeclarationSyntax.cs

示例14: WritePropertySyntax

		public override void WritePropertySyntax (XPathNavigator reflection, SyntaxWriter writer) {

			if (IsUnsupportedUnsafe(reflection, writer)) return;

			string name = (string) reflection.Evaluate(apiNameExpression);
			bool getter = (bool) reflection.Evaluate(apiIsReadPropertyExpression);
			bool setter = (bool) reflection.Evaluate(apiIsWritePropertyExpression);
            bool isDefault = (bool)reflection.Evaluate(apiIsDefaultMemberExpression);
            bool isExplicit = (bool)reflection.Evaluate(apiIsExplicitImplementationExpression);
			XPathNavigator type = reflection.SelectSingleNode(apiReturnTypeExpression);

			WriteAttributes(reflection, writer);
			WriteProcedureModifiers(reflection, writer);
			if (getter && !setter) {
				writer.WriteKeyword("ReadOnly");
				writer.WriteString(" ");
			} else if (setter && !getter) {
				writer.WriteKeyword("WriteOnly");
				writer.WriteString(" ");
			}
            if (isDefault) {
                writer.WriteKeyword("Default");
                writer.WriteString(" ");
            }
			writer.WriteKeyword("Property");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
			WriteParameters(reflection, writer);
			writer.WriteString(" ");
			writer.WriteKeyword("As");
			writer.WriteString(" ");
			WriteTypeReference(type, writer);

			if (isExplicit) {
                if (writer.Position > maxPosition) {
                    writer.WriteLine();
                    writer.WriteString("\t");
                } else {
                    writer.WriteString(" ");
                }
                writer.WriteKeyword("Implements");
				writer.WriteString(" ");
				XPathNodeIterator implementations = reflection.Select(apiImplementedMembersExpression);
				while (implementations.MoveNext()) {
					XPathNavigator implementation = implementations.Current;
					XPathNavigator contract = implementation.SelectSingleNode(memberDeclaringTypeExpression);
					//string id = implementation.GetAttribute("api", String.Empty);
					if (implementations.CurrentPosition > 1) writer.WriteString(", ");
					WriteTypeReference(contract, writer);
					writer.WriteString(".");
                    WriteMemberReference(implementation, writer);
					//writer.WriteReferenceLink(id);	
				}
			}

            if (getter)
            {
                writer.WriteLine();
                writer.WriteString("\t");
                string getVisibility = (string)reflection.Evaluate(apiGetVisibilityExpression);
                if (!String.IsNullOrEmpty(getVisibility))
                {
                    WriteVisibility(getVisibility, writer);
                    writer.WriteString(" ");
                }
                writer.WriteKeyword("Get");
            }
            if (setter)
            {
                writer.WriteLine();
                writer.WriteString("\t");
                string setVisibility = (string)reflection.Evaluate(apiSetVisibilityExpression);
                if (!String.IsNullOrEmpty(setVisibility))
                {
                    WriteVisibility(setVisibility, writer);
                    writer.WriteString(" ");
                }
                writer.WriteKeyword("Set");
            }
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:80,代码来源:VisualBasicDeclarationSyntax.cs

示例15: WriteGenericTemplateConstraints

		private void WriteGenericTemplateConstraints (XPathNavigator reflection, SyntaxWriter writer) {

			XPathNodeIterator templates = reflection.Select(apiTemplatesExpression);

            if (templates.Count == 0) return;

            writer.WriteLine();
			foreach (XPathNavigator template in templates) {

				bool constrained = (bool) template.Evaluate(templateIsConstrainedExpression);
				if (constrained) {
					string name = (string) template.Evaluate(templateNameExpression);
                                        
					writer.WriteKeyword("where");
                    writer.WriteString(" ");
					writer.WriteString(name);
					writer.WriteString(" : ");
				} else {
					continue;
				}

				bool value = (bool) template.Evaluate(templateIsValueTypeExpression);
				bool reference = (bool) template.Evaluate(templateIsReferenceTypeExpression);
				bool constructor = (bool) template.Evaluate(templateIsConstructableExpression);
				XPathNodeIterator constraints = template.Select(templateConstraintsExpression);

				// keep track of whether there is a previous constraint, so we know whether to put a comma
				bool previous = false;

				if (value) {
					if (previous) writer.WriteString(", ");
					writer.WriteKeyword("struct");
					previous = true;
				}
				
				if (reference) {
					if (previous) writer.WriteString(", ");
					writer.WriteKeyword("class");
					previous = true;
				}

				if (constructor) {
					if (previous) writer.WriteString(", ");
					writer.WriteKeyword("new");
					writer.WriteString("()");
					previous = true;
				}

				foreach (XPathNavigator constraint in constraints) {
					if (previous) writer.WriteString(", ");
					WriteTypeReference(constraint, writer);
					previous = true;
				}
                writer.WriteLine();
			}

		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:57,代码来源:CSharpDeclarationSyntax.cs


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