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


C# SyntaxWriter.WriteIdentifier方法代码示例

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


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

示例1: WriteClassSyntax

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

			if (IsUnsupportedGeneric(reflection, writer)) return;

			string name = reflection.Evaluate(apiNameExpression).ToString();
			bool isAbstract = (bool) reflection.Evaluate(apiIsAbstractTypeExpression);
			bool isSealed = (bool) reflection.Evaluate(apiIsSealedTypeExpression);
			bool isSerializable = (bool) reflection.Evaluate(apiIsSerializableTypeExpression);

			if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);
			WriteAttributes(reflection, writer);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			if (isSealed) {
				writer.WriteKeyword("final");
				writer.WriteString(" ");
			} else if (isAbstract) {
				writer.WriteKeyword("abstract");
				writer.WriteString(" ");
			}
			writer.WriteKeyword("class");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);

			XPathNavigator baseClass = reflection.SelectSingleNode(apiBaseClassExpression);
			if ((baseClass != null) && !((bool) baseClass.Evaluate(typeIsObjectExpression))) {
				writer.WriteString(" ");
				writer.WriteKeyword("extends");
				writer.WriteString(" ");
				WriteTypeReference(baseClass, writer);
			}

			WriteImplementedInterfaces(reflection, writer);

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

示例2: WriteNamespaceSyntax

        public override void WriteNamespaceSyntax (XPathNavigator reflection, SyntaxWriter writer) {
            string name = (string)reflection.Evaluate(apiNameExpression);

            writer.WriteKeyword("package");
            writer.WriteString(" ");
            writer.WriteIdentifier(name);
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:7,代码来源:JScriptDeclarationSyntax.cs

示例3: 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

示例4: WriteClassSyntax

        // class: done
		public override void WriteClassSyntax (XPathNavigator reflection, SyntaxWriter writer) {

			string name = (string) reflection.Evaluate(apiNameExpression);
			bool isAbstract = (bool) reflection.Evaluate(apiIsAbstractTypeExpression);
			bool isSealed = (bool) reflection.Evaluate(apiIsSealedTypeExpression);
			bool isSerializable = (bool) reflection.Evaluate(apiIsSerializableTypeExpression);

			if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);
			WriteAttributes(reflection, writer);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			if (isAbstract) {
				if (isSealed) {
					// static -- VB doesn't really handle this case
					writer.WriteKeyword("NotInheritable");
					writer.WriteString(" ");
				} else {
					writer.WriteKeyword("MustInherit");
					writer.WriteString(" ");
				}
			} else if (isSealed) {
				writer.WriteKeyword("NotInheritable");
				writer.WriteString(" ");
			}
			writer.WriteKeyword("Class");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
			WriteGenericTemplates(reflection, writer);
			WriteBaseClass(reflection, writer);
			WriteImplementedInterfaces(reflection, writer);
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:32,代码来源:VisualBasicDeclarationSyntax.cs

示例5: WriteClassSyntax

        // class: done
		public override void WriteClassSyntax (XPathNavigator reflection, SyntaxWriter writer) {

			string name = reflection.Evaluate(apiNameExpression).ToString();
			bool isAbstract = (bool) reflection.Evaluate(apiIsAbstractTypeExpression);
			bool isSealed = (bool) reflection.Evaluate(apiIsSealedTypeExpression);
			bool isSerializable = (bool) reflection.Evaluate(apiIsSerializableTypeExpression);

			if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);
			WriteAttributes(reflection, writer);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			if (isAbstract) {
				if (isSealed) {
					writer.WriteKeyword("static");
				} else {
					writer.WriteKeyword("abstract");
				}
				writer.WriteString(" ");
			} else {
				if (isSealed) {
					writer.WriteKeyword("sealed");
					writer.WriteString(" ");
				}
			}
			writer.WriteKeyword("class");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
			WriteGenericTemplates(reflection, writer);
			WriteBaseClassAndImplementedInterfaces(reflection, writer);
			WriteGenericTemplateConstraints(reflection, writer);

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

示例6: TypeDeclaration

        private void TypeDeclaration (XPathNavigator reflection, SyntaxWriter writer, bool writeVariance) {
            string name = (string)reflection.Evaluate(apiNameExpression);
            XPathNavigator declaringType = reflection.SelectSingleNode(apiContainingTypeExpression);

            writer.WriteKeyword("Dim");
            writer.WriteString(" ");
            writer.WriteParameter("instance");
            writer.WriteString(" ");
            writer.WriteKeyword("As");
            writer.WriteString(" ");
            if (declaringType != null) {
                WriteTypeReference(declaringType, writer);
                writer.WriteString(".");
            }
            if (reservedWords.ContainsKey(name)) {
                writer.WriteString("[");
                writer.WriteIdentifier(name);
                writer.WriteString("]");
            } else {
                writer.WriteIdentifier(name);
            }
            WriteGenericTemplates(reflection, writer, writeVariance);
        }
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:23,代码来源:VisualBasicUsageSyntax.cs

示例7: WriteStructureSyntax

        // structure: add base type
		public override void WriteStructureSyntax (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);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			writer.WriteKeyword("Structure");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
			WriteGenericTemplates(reflection, writer);
			WriteImplementedInterfaces(reflection, writer);
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:16,代码来源:VisualBasicDeclarationSyntax.cs

示例8: WriteStructureSyntax

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

			if (IsUnsupportedGeneric(reflection, writer)) return;

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

			if (isSerializable) WriteAttribute("T:System.SerializableAttribute", writer);
			WriteAttributes(reflection, writer);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			writer.WriteKeyword("final");
			writer.WriteString(" ");
			writer.WriteKeyword("class");
			writer.WriteString(" ");
			writer.WriteIdentifier(name);

			writer.WriteString(" ");
			writer.WriteKeyword("extends");
			writer.WriteString(" ");
			writer.WriteReferenceLink("T:System.ValueType");

			WriteImplementedInterfaces(reflection, writer);
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:24,代码来源:JSharpDeclarationSyntax.cs

示例9: WriteAttachedEventSyntax

        public override void WriteAttachedEventSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            string eventName = (string)reflection.Evaluate(apiNameExpression);
            string containingTypeName = (string)reflection.Evaluate(apiContainingTypeNameExpression);
            XPathNavigator eventHandler = reflection.SelectSingleNode(apiHandlerOfEventExpression);

            // xaml syntax block for attached event
            string xamlBlockId = System.Enum.GetName(typeof(XamlHeadingID), XamlHeadingID.xamlAttributeUsageHeading);
            writer.WriteStartSubBlock(xamlBlockId);

            writer.WriteString("<");
            writer.WriteParameter("object");
            writer.WriteString(" ");
            writer.WriteIdentifier(containingTypeName + "." + eventName);
            writer.WriteString("=\"");
            WriteTypeReference(eventHandler, writer);
            writer.WriteString(string.Format("\" .../>"));

            writer.WriteEndSubBlock();
        }
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:20,代码来源:XamlUsageSyntax.cs

示例10: WriteEventSyntax

        public override void WriteEventSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            string eventName = (string)reflection.Evaluate(apiNameExpression);
            string eventVisibility = (string)reflection.Evaluate(apiVisibilityExpression);
            bool isAbstract = (bool)reflection.Evaluate(apiIsAbstractProcedureExpression);
            XPathNavigator eventHandler = reflection.SelectSingleNode(apiHandlerOfEventExpression);

            XPathNavigator containingType = reflection.SelectSingleNode(apiContainingTypeExpression);
            string containingTypeSubgroup = (string)containingType.Evaluate(apiSubgroupExpression);
            bool containingTypeIsAbstract = (bool)containingType.Evaluate(apiIsAbstractTypeExpression);
            bool containingTypeIsSealed = (bool)containingType.Evaluate(apiIsSealedTypeExpression);

            if (containingTypeSubgroup == "interface")
            {
                WriteXamlBoilerplate(XamlBoilerplateID.eventXamlSyntax_noXamlSyntaxForInterfaceMembers, writer);
            }
            else if (containingTypeIsAbstract && containingTypeIsSealed)
            {
                // the event's containing type is static if it's abstract and sealed
                // members of a static class cannot be used in XAML.
                WriteXamlBoilerplate(XamlBoilerplateID.eventXamlSyntax_nonXamlParent, writer);
            }
            else if (IsExcludedSubClass(containingType))
            {
                WriteXamlBoilerplate(XamlBoilerplateID.eventXamlSyntax_parentIsExcludedSubClass, writer);
            }
            else if (!DoesParentSupportXaml(reflection))
            {
                WriteXamlBoilerplate(XamlBoilerplateID.eventXamlSyntax_nonXamlParent, writer);
            }
            else if (eventVisibility != "public")
            {
                WriteXamlBoilerplate(XamlBoilerplateID.eventXamlSyntax_notPublic, writer);
            }
            else if (isAbstract)
            {
                WriteXamlBoilerplate(XamlBoilerplateID.eventXamlSyntax_abstract, writer);
            }
            else
            {
                // start the syntax block
                string xamlBlockId = System.Enum.GetName(typeof(XamlHeadingID), XamlHeadingID.xamlAttributeUsageHeading);
                writer.WriteStartSubBlock(xamlBlockId);

                // syntax looks like: 
                //   <object eventName="eventHandlerLink" .../>
                writer.WriteString("<");
                writer.WriteParameter("object");
                writer.WriteString(" ");
                writer.WriteIdentifier(eventName);
                writer.WriteString("=\"");
                WriteTypeReference(eventHandler, writer);
                writer.WriteString("\" .../>");

                writer.WriteEndSubBlock();
            }
        }
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:57,代码来源:XamlUsageSyntax.cs

示例11: PropertyAttributeUsage

        // An Attribute Usage block
        private void PropertyAttributeUsage(XPathNavigator propertyReflection, SyntaxWriter writer)
        {
            string xamlBlockId = System.Enum.GetName(typeof(XamlHeadingID), XamlHeadingID.xamlAttributeUsageHeading);
            string propertyName = (string)propertyReflection.Evaluate(apiNameExpression);
            XPathNavigator returnType = propertyReflection.SelectSingleNode(apiReturnTypeExpression);

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

            // syntax looks like: 
            //   <object PropertyName="linkToType" .../>
            writer.WriteString("<");
            writer.WriteParameter("object");
            writer.WriteString(" ");
            writer.WriteIdentifier(propertyName);
            writer.WriteString("=\"");
            WriteTypeReference(returnType, writer);
            writer.WriteString("\" .../>");

            writer.WriteEndSubBlock();
        }
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:22,代码来源:XamlUsageSyntax.cs

示例12: PropertyElementUsageGrande

        // A grandiose Property Element Usage block
        // syntax looks like: 
        //   <object>
        //     <object.PropertyName>
        //       <linkToType .../>
        //     </object.PropertyName>
        //   </object>
        private void PropertyElementUsageGrande(XPathNavigator propertyReflection, SyntaxWriter writer)
        {
            string xamlBlockId = System.Enum.GetName(typeof(XamlHeadingID), XamlHeadingID.xamlPropertyElementUsageHeading);
            string propertyName = (string)propertyReflection.Evaluate(apiNameExpression);
            XPathNavigator returnType = propertyReflection.SelectSingleNode(apiReturnTypeExpression);

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

            //   <object>
            writer.WriteString("<");
            writer.WriteParameter("object");
            writer.WriteString(">");
            writer.WriteLine();
            //     <object.PropertyName>
            writer.WriteString("  <");
            writer.WriteParameter("object");
            writer.WriteString(".");
            writer.WriteIdentifier(propertyName);
            writer.WriteString(">");
            writer.WriteLine();
            //       <linkToType .../>
            writer.WriteString("    <");
            WriteTypeReference(returnType, writer);
            writer.WriteString(" .../>");
            writer.WriteLine();
            //     </object.PropertyName>
            writer.WriteString("  </");
            writer.WriteParameter("object");
            writer.WriteString(".");
            writer.WriteIdentifier(propertyName);
            writer.WriteString(">");
            writer.WriteLine();
            //   </object>
            writer.WriteString("</");
            writer.WriteParameter("object");
            writer.WriteString(">");

            writer.WriteEndSubBlock();
        }
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:47,代码来源:XamlUsageSyntax.cs

示例13: WriteAttachedPropertySyntax

 public override void WriteAttachedPropertySyntax(XPathNavigator reflection, SyntaxWriter writer)
 {
     string propertyName = (string)reflection.Evaluate(apiNameExpression);
     string containingTypeName = (string)reflection.Evaluate(apiContainingTypeNameExpression);
     bool isSettable = (bool)reflection.Evaluate(apiIsWritePropertyExpression);
     XPathNavigator returnType = reflection.SelectSingleNode(apiReturnTypeExpression);
     if (!isSettable)
     {
         WriteXamlBoilerplate(XamlBoilerplateID.propertyXamlSyntax_readOnly, writer);
     }
     else
     {
         // xaml syntax block for attached property
         string xamlBlockId = System.Enum.GetName(typeof(XamlHeadingID), XamlHeadingID.xamlAttributeUsageHeading);
         writer.WriteStartSubBlock(xamlBlockId);
         writer.WriteString("<");
         writer.WriteParameter("object");
         writer.WriteString(" ");
         writer.WriteIdentifier(containingTypeName + "." + propertyName);
         writer.WriteString("=\"");
         WriteTypeReference(returnType, writer);
         writer.WriteString("\" .../>");
         writer.WriteEndSubBlock();
     }
 }
开发者ID:hnlshzx,项目名称:DotNetOpenAuth,代码行数:25,代码来源:XamlUsageSyntax.cs

示例14: 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

示例15: WriteDelegateSyntax

        // delegate: done
		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);
			WriteVisibility(reflection, writer);
			writer.WriteString(" ");
			writer.WriteKeyword("delegate");
			writer.WriteString(" ");
			WriteReturnValue(reflection, writer);
			writer.WriteString(" ");
			writer.WriteIdentifier(name);
			WriteGenericTemplates(reflection, writer, true); // delegates need co/contravariance info
			WriteMethodParameters(reflection, writer);
			WriteGenericTemplateConstraints(reflection, writer);
			
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:20,代码来源:CSharpDeclarationSyntax.cs


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