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


C# SyntaxWriter.WriteParameter方法代码示例

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


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

示例1: WriteParameter

        // JScript has no in, out, optional, or reference parameters
        private static void WriteParameter(XPathNavigator parameter, SyntaxWriter writer)
        {
            string name = (string)parameter.Evaluate(parameterNameExpression);
            XPathNavigator type = parameter.SelectSingleNode(parameterTypeExpression);
            bool isParamArray = (bool)parameter.Evaluate(parameterIsParamArrayExpression);

            if(isParamArray)
                writer.WriteString("... ");

            writer.WriteParameter(name);
            writer.WriteString(" : ");
            WriteTypeReference(type, writer);
        }
开发者ID:armin-bauer,项目名称:SHFB,代码行数:14,代码来源:JScriptDeclarationSyntax.cs

示例2: WriteEventSyntax

        /// <inheritdoc />
        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.WriteIdentifier(eventName);
                writer.WriteString("=\"");
                WriteTypeReference(eventHandler, writer);
                writer.WriteString("\" .../>");

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

示例3: WriteParameters

        // Parameters

        private void WriteParameters(XPathNavigator reflection, SyntaxWriter writer)
        {
            XPathNodeIterator parameters = reflection.Select(apiParametersExpression);

            if(parameters.Count == 0)
                return;

            writer.WriteString(" ( ");

            if(includeLineContinuation)
                writer.WriteString("_");

            writer.WriteLine();

            while(parameters.MoveNext())
            {
                XPathNavigator parameter = parameters.Current;

                // !EFW - Added support for optional parameter values
                XPathNavigator argument = (XPathNavigator)parameter.SelectSingleNode(parameterArgumentExpression);
                bool isOptional = (bool)parameter.Evaluate(parameterIsOptionalExpression);

                XPathNavigator type = parameter.SelectSingleNode(parameterTypeExpression);
                string name = (string)parameter.Evaluate(parameterNameExpression);
                bool isOut = (bool)parameter.Evaluate(parameterIsOutExpression);
                bool isParamArray = (bool)parameter.Evaluate(parameterIsParamArrayExpression);
                bool isByRef = (bool)parameter.Evaluate(parameterIsRefExpression);

                writer.WriteString("\t");

                // !EFW - Optional indicated by OptionalAttribute?
                if(isOptional && argument == null)
                {
                    WriteAttribute("T:System.Runtime.InteropServices.OptionalAttribute", false, writer);
                    writer.WriteString(" ");
                }

                if(isOut)
                {
                    WriteAttribute("T:System.Runtime.InteropServices.OutAttribute", false, writer);
                    writer.WriteString(" ");
                }

                // !EFW - Write out parameter attributes
                WriteAttributes(parameter, writer, null, true);

                // !EFW - Write optional value if present
                if(argument != null)
                    writer.WriteString("Optional ");

                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);

                // !EFW - Write optional value if present
                if(argument != null)
                {
                    writer.WriteString(" = ");
                    this.WriteValue(argument, writer);
                }

                if(parameters.CurrentPosition < parameters.Count)
                    writer.WriteString(",");

                if(includeLineContinuation)
                    writer.WriteString(" _");

                writer.WriteLine();
            }

            writer.WriteString(")");
        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:88,代码来源:VisualBasicDeclarationSyntax.cs

示例4: WriteParameters

        private void WriteParameters(XPathNodeIterator parameters, SyntaxWriter writer)
        {
            while(parameters.MoveNext())
            {
                XPathNavigator parameter = parameters.Current;

                // !EFW - Added support for optional parameter values
                XPathNavigator argument = (XPathNavigator)parameter.SelectSingleNode(parameterArgumentExpression);
                bool isOptional = (bool)parameter.Evaluate(parameterIsOptionalExpression);

                string name = (string)parameter.Evaluate(parameterNameExpression);
                XPathNavigator type = parameter.SelectSingleNode(parameterTypeExpression);
                bool isIn = (bool)parameter.Evaluate(parameterIsInExpression);
                bool isOut = (bool)parameter.Evaluate(parameterIsOutExpression);
                bool isRef = (bool)parameter.Evaluate(parameterIsRefExpression);

                writer.WriteString("\t");

                // !EFW - Optional indicated by OptionalAttribute?
                if(isOptional && argument == null)
                    WriteAttribute("T:System.Runtime.InteropServices.OptionalAttribute", writer, false);

                if(isIn)
                    WriteAttribute("T:System.Runtime.InteropServices.InAttribute", writer, false);

                if(isOut)
                    WriteAttribute("T:System.Runtime.InteropServices.OutAttribute", writer, false);

                // !EFW - Write out parameter attributes
                WriteAttributes(parameter, writer, true);

                if(isRef)
                    writer.WriteString("/** @ref */");

                WriteTypeReference(type, writer);
                writer.WriteString(" ");
                writer.WriteParameter(name);

                // !EFW - Write optional value if present
                if(argument != null)
                {
                    writer.WriteString(" = ");
                    this.WriteValue(argument, writer);
                }

                if(parameters.CurrentPosition < parameters.Count)
                    writer.WriteString(",");

                writer.WriteLine();
            }
        }
开发者ID:armin-bauer,项目名称:SHFB,代码行数:51,代码来源:JSharpDeclarationSyntax.cs

示例5: 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:natarajanmca11,项目名称:SHFB,代码行数:47,代码来源:XamlUsageSyntax.cs

示例6: WriteParameters

        private void WriteParameters(XPathNodeIterator parameters, SyntaxWriter writer)
        {
            while(parameters.MoveNext())
            {
                XPathNavigator parameter = parameters.Current;
                string name = (string)parameter.Evaluate(parameterNameExpression);
                writer.WriteParameter(name);

                if(parameters.CurrentPosition < parameters.Count)
                {
                    writer.WriteString(", ");

                    if(writer.Position > MaxPosition)
                    {
                        if(includeLineContinuation)
                            writer.WriteString("_");

                        writer.WriteLine();
                        writer.WriteString("\t");
                    }
                }
            }
        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:23,代码来源:VisualBasicUsageSyntax.cs

示例7: WritePropertySyntax

        /// <inheritdoc />
        public override void WritePropertySyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            if(IsUnsupportedUnsafe(reflection, writer))
                return;

            if(IsUnsupportedExplicit(reflection, writer))
                return;

            string name = (string)reflection.Evaluate(apiNameExpression);
            bool isGettable = (bool)reflection.Evaluate(apiIsReadPropertyExpression);
            bool isSettable = (bool)reflection.Evaluate(apiIsWritePropertyExpression);

            if(isGettable)
            {
                writer.WriteString("/** @property */");
                writer.WriteLine();

                // !EFW - Added support for getter/setter attributes
                XPathNavigator getter = reflection.SelectSingleNode(apiGetterExpression);

                if(getter != null && getter.HasChildren)
                    this.WriteAttributes(getter, writer);

                // write getter method
                WriteAttributes(reflection, writer);
                WriteProcedureModifiers(reflection, writer);
                WriteReturnValue(reflection, writer);
                writer.WriteString(" ");
                writer.WriteIdentifier("get_" + name);
                WriteMethodParameters(reflection, writer);
                writer.WriteLine();
            }

            if(isSettable)
            {
                writer.WriteString("/** @property */");
                writer.WriteLine();

                // !EFW - Added support for getter/setter attributes
                XPathNavigator setter = reflection.SelectSingleNode(apiSetterExpression);

                if(setter != null && setter.HasChildren)
                    this.WriteAttributes(setter, writer);

                // write setter method
                WriteAttributes(reflection, writer);
                WriteProcedureModifiers(reflection, writer);
                writer.WriteKeyword("void");
                writer.WriteString(" ");
                writer.WriteIdentifier("set_" + name);

                // parameters
                writer.WriteString("(");
                WriteReturnValue(reflection, writer);
                writer.WriteString(" ");
                writer.WriteParameter("value");
                writer.WriteString(")");

                // end parameters
                writer.WriteLine();
            }
        }
开发者ID:armin-bauer,项目名称:SHFB,代码行数:63,代码来源:JSharpDeclarationSyntax.cs

示例8: ParameterDeclaration

        private void ParameterDeclaration(string name, XPathNavigator type, SyntaxWriter writer)
        {
            writer.WriteKeyword("Dim");
            writer.WriteString(" ");
            writer.WriteParameter(name);
            writer.WriteString(" ");
            writer.WriteKeyword("As");
            writer.WriteString(" ");

            string typeName = (string)type.Evaluate(apiNameExpression);

            if(reservedWords.Contains(typeName))
            {
                writer.WriteString("[");
                WriteTypeReference(type, writer);
                writer.WriteString("]");
            }
            else
            {
                WriteTypeReference(type, writer);
            }

            writer.WriteLine();
        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:24,代码来源:VisualBasicUsageSyntax.cs

示例9: WriteDelegateSyntax

        /// <inheritdoc />
        public override void WriteDelegateSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            if(IsUnsupportedUnsafe(reflection, writer))
                return;

            string name = (string)reflection.Evaluate(apiNameExpression);

            writer.WriteKeyword("Dim");
            writer.WriteString(" ");
            writer.WriteParameter("instance");
            writer.WriteString(" ");
            writer.WriteKeyword("As");
            writer.WriteString(" ");
            writer.WriteKeyword("New");
            writer.WriteString(" ");

            if(reservedWords.Contains(name))
            {
                writer.WriteString("[");
                writer.WriteIdentifier(name);
                writer.WriteString("]");
            }
            else
            {
                writer.WriteIdentifier(name);
            }

            WriteGenericTemplates(reflection, writer, true); // Need to write variance info for interfaces and delegates
            writer.WriteString("(");
            writer.WriteKeyword("AddressOf");
            writer.WriteString(" HandlerMethod)");
        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:33,代码来源:VisualBasicUsageSyntax.cs

示例10: WriteEventSyntax

        /// <summary>
        /// Write out event syntax
        /// </summary>
        /// <param name="reflection">The reflection information</param>
        /// <param name="writer">The syntax writer to which it is written</param>
        public override void WriteEventSyntax(XPathNavigator reflection,
          SyntaxWriter writer)
        {
            if(!this.IsUnsupported(reflection, writer))
            {
                if(reflection.Select(
                  SyntaxGeneratorTemplate.apiParametersExpression).Count > 0)
                    writer.WriteMessage("UnsupportedIndex_" + this.Language);
                else
                {
                    string identifier = ReadMemberName(reflection);

                    writer.WriteKeyword("function");
                    writer.WriteString(" add_");
                    writer.WriteIdentifier(identifier);
                    writer.WriteString("(");
                    writer.WriteParameter("value");
                    writer.WriteString(");");
                    writer.WriteLine();
                    writer.WriteKeyword("function");
                    writer.WriteString(" remove_");
                    writer.WriteIdentifier(identifier);
                    writer.WriteString("(");
                    writer.WriteParameter("value");
                    writer.WriteString(");");
                }
            }
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:33,代码来源:JavaScriptDeclarationSyntaxGenerator.cs

示例11: WritePropertySyntax

        /// <summary>
        /// Write out property syntax if supported
        /// </summary>
        /// <param name="reflection">The reflection information</param>
        /// <param name="writer">The syntax writer to which it is written</param>
        public override void WritePropertySyntax(XPathNavigator reflection,
          SyntaxWriter writer)
        {
            if(this.IsUnsupported(reflection, writer))
                return;

            if(HasAttribute(reflection, "System.IntrinsicPropertyAttribute"))
            {
                this.WriteFieldSyntax(reflection, writer);
                return;
            }

            string identifier = ReadMemberName(reflection);
            bool isStatic = (bool)reflection.Evaluate(
                SyntaxGeneratorTemplate.apiIsStaticExpression);
            bool isReadProp = (bool)reflection.Evaluate(
                SyntaxGeneratorTemplate.apiIsReadPropertyExpression);
            bool isWriteProp = (bool) reflection.Evaluate(
                SyntaxGeneratorTemplate.apiIsWritePropertyExpression);

// EFW - Unused so removed
//            XPathNavigator navigator = reflection.SelectSingleNode(
//                SyntaxGeneratorTemplate.apiReturnTypeExpression);

            if(isReadProp)
            {
                if(isStatic)
                {
                    writer.WriteIdentifier(ReadFullContainingTypeName(
                        reflection));
                    writer.WriteString(".");
                    writer.WriteString("get_");
                    writer.WriteIdentifier(identifier);
                    writer.WriteString(" = ");
                    writer.WriteKeyword("function");
                }
                else
                {
                    writer.WriteKeyword("function");
                    writer.WriteString(" ");
                    writer.WriteString("get_");
                    writer.WriteIdentifier(identifier);
                }

                WriteParameterList(reflection, writer);
                writer.WriteString(";");
                writer.WriteLine();
            }

            if(isWriteProp)
            {
                if(isStatic)
                {
                    writer.WriteIdentifier(ReadFullContainingTypeName(
                        reflection));
                    writer.WriteString(".");
                    writer.WriteString("set_");
                    writer.WriteIdentifier(identifier);
                    writer.WriteString(" = ");
                    writer.WriteKeyword("function");
                }
                else
                {
                    writer.WriteKeyword("function");
                    writer.WriteString(" ");
                    writer.WriteString("set_");
                    writer.WriteIdentifier(identifier);
                }

                writer.WriteString("(");
                writer.WriteParameter("value");
                writer.WriteString(");");
            }
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:79,代码来源:JavaScriptDeclarationSyntaxGenerator.cs

示例12: WriteParameter

        /// <summary>
        /// Write out a parameter
        /// </summary>
        /// <param name="parameter">The parameter information</param>
        /// <param name="writer">The syntax writer to which it is written</param>
        private static void WriteParameter(XPathNavigator parameter,
          SyntaxWriter writer)
        {
            string paramName = (string)parameter.Evaluate(
                SyntaxGeneratorTemplate.parameterNameExpression);

// EFW - Unused so removed
//            XPathNavigator navigator = parameter.SelectSingleNode(
//                SyntaxGeneratorTemplate.parameterTypeExpression);

            if((bool)parameter.Evaluate(
              SyntaxGeneratorTemplate.parameterIsParamArrayExpression))
            {
                writer.WriteString("... ");
            }

            writer.WriteParameter(paramName);
        }
开发者ID:julianhaslinger,项目名称:SHFB,代码行数:23,代码来源:JavaScriptDeclarationSyntaxGenerator.cs

示例13: WriteEventSyntax

        /// <inheritdoc />
        public override void WriteEventSyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            string name = (string)reflection.Evaluate(apiNameExpression);
            XPathNavigator handler = reflection.SelectSingleNode(apiHandlerOfEventExpression);

            // !EFW - Write visibility before attributes
            WriteProcedureVisibility(reflection, writer);

            WriteAttributes(reflection, writer);
            WritePrefixProcedureModifiers(reflection, writer);
            writer.WriteString(" ");
            writer.WriteKeyword("event");
            writer.WriteString(" ");
            WriteTypeReference(handler, writer);
            writer.WriteString(" ");
            writer.WriteIdentifier(name);
            writer.WriteString(" {");
            writer.WriteLine();

            writer.WriteString("\t");
            writer.WriteKeyword("void");
            writer.WriteString(" ");
            writer.WriteKeyword("add");
            writer.WriteString(" (");
            WriteTypeReference(handler, writer);
            writer.WriteString(" ");
            writer.WriteParameter("value");
            writer.WriteString(")");
            writer.WriteString(";");
            writer.WriteLine();

            writer.WriteString("\t");
            writer.WriteKeyword("void");
            writer.WriteString(" ");
            writer.WriteKeyword("remove");
            writer.WriteString(" (");
            WriteTypeReference(handler, writer);
            writer.WriteString(" ");
            writer.WriteParameter("value");
            writer.WriteString(")");
            writer.WriteString(";");
            writer.WriteLine();


            writer.WriteString("}");

        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:48,代码来源:ManagedCPlusPlusDeclarationSyntax.cs

示例14: WritePropertySyntax

        /// <inheritdoc />
        public override void WritePropertySyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            string name = (string)reflection.Evaluate(apiNameExpression);
            bool isDefault = (bool)reflection.Evaluate(apiIsDefaultMemberExpression);
            bool hasGetter = (bool)reflection.Evaluate(apiIsReadPropertyExpression);
            bool hasSetter = (bool)reflection.Evaluate(apiIsWritePropertyExpression);
            bool isExplicit = (bool)reflection.Evaluate(apiIsExplicitImplementationExpression);
            XPathNodeIterator parameters = reflection.Select(apiParametersExpression);

            // !EFW - Write visibility before attributes
            WriteProcedureVisibility(reflection, writer);

            WriteAttributes(reflection, writer);
            WritePrefixProcedureModifiers(reflection, writer);
            writer.WriteKeyword("property");
            writer.WriteString(" ");
            WriteReturnValue(reflection, writer);
            writer.WriteString(" ");

            // if is default member, write default, otherwise write name
            if(isDefault)
            {
                writer.WriteKeyword("default");
            }
            else
            {
                writer.WriteIdentifier(name);
            }

            if(parameters.Count > 0)
            {
                writer.WriteString("[");
                WriteParameters(parameters.Clone(), false, writer);
                writer.WriteString("]");
            }

            writer.WriteString(" {");
            writer.WriteLine();

            if(hasGetter)
            {
                // !EFW - Added support for getter/setter attributes
                XPathNavigator getter = reflection.SelectSingleNode(apiGetterExpression);

                if(getter != null && !getter.HasChildren)
                    writer.WriteString("\t");

                // write the get visibility
                string getVisibility = (string)reflection.Evaluate(apiGetVisibilityExpression);

                if(!String.IsNullOrEmpty(getVisibility))
                {
                    WriteVisibility(getVisibility, writer);
                    writer.WriteString(":");

                    if(!getter.HasChildren)
                        writer.WriteString(" ");
                    else
                        writer.WriteLine();
                }

                if(getter != null && getter.HasChildren)
                {
                    writer.WriteString("\t");
                    this.WriteAttributes(getter, writer, "\t");
                    writer.WriteString("\t");
                }

                WriteReturnValue(reflection, writer);

                writer.WriteString(" ");
                writer.WriteKeyword("get");
                writer.WriteString(" ");

                writer.WriteString("(");
                WriteParameters(parameters.Clone(), false, writer);
                writer.WriteString(")");

                WritePostfixProcedureModifiers(reflection, writer);

                if(isExplicit)
                {
                    XPathNavigator implement = reflection.SelectSingleNode(apiImplementedMembersExpression);
                    XPathNavigator contract = implement.SelectSingleNode(memberDeclaringTypeExpression);
                    //string id = (string) implement.GetAttribute("api", String.Empty);

                    writer.WriteString(" = ");
                    WriteTypeReference(contract, false, writer);
                    writer.WriteString("::");
                    WriteMemberReference(implement, writer);
                    //writer.WriteReferenceLink(id);
                    writer.WriteString("::");
                    writer.WriteKeyword("get");
                }

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

//.........这里部分代码省略.........
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:101,代码来源:ManagedCPlusPlusDeclarationSyntax.cs

示例15: WritePropertySyntax

        /// <inheritdoc />
        public override void WritePropertySyntax(XPathNavigator reflection, SyntaxWriter writer)
        {
            if(IsUnsupportedUnsafe(reflection, writer))
                return;

            bool isStatic = (bool)reflection.Evaluate(apiIsStaticExpression);
            bool isFamily = (bool)reflection.Evaluate(apiIsFamilyMemberExpression);
            XPathNavigator declaringType = reflection.SelectSingleNode(apiContainingTypeExpression);
            XPathNavigator propertyType = reflection.SelectSingleNode(apiReturnTypeExpression);
            bool getter = (bool)reflection.Evaluate(apiIsReadPropertyExpression);
            bool setter = (bool)reflection.Evaluate(apiIsWritePropertyExpression);

            if(!(isStatic || isFamily))
                ParameterDeclaration("instance", declaringType, writer);
            WriteParameterDeclarations(reflection, writer);
            ParameterDeclaration("value", propertyType, writer);

            // get value
            if(getter)
            {
                string getVisibility = (string)reflection.Evaluate(apiGetVisibilityExpression);
                if(string.IsNullOrEmpty(getVisibility) || (getVisibility != "assembly" &&
                    getVisibility != "private" && getVisibility != "family and assembly"))
                {
                    writer.WriteLine();
                    writer.WriteParameter("value");
                    writer.WriteString(" = ");
                    WriteMemberName(reflection, writer);
                    WritePropertyParameters(reflection, writer);
                    writer.WriteLine();
                }
            }

            // set value
            if(setter)
            {
                string setVisibility = (string)reflection.Evaluate(apiSetVisibilityExpression);
                if(string.IsNullOrEmpty(setVisibility) || (setVisibility != "assembly" &&
                    setVisibility != "private" && setVisibility != "family and assembly"))
                {
                    writer.WriteLine();
                    WriteMemberName(reflection, writer);
                    WritePropertyParameters(reflection, writer);
                    writer.WriteString(" = ");
                    writer.WriteParameter("value");
                }
            }

        }
开发者ID:modulexcite,项目名称:SHFB-1,代码行数:50,代码来源:VisualBasicUsageSyntax.cs


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