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


C# ICodeWriter.Write方法代码示例

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


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

示例1: Render

        public override void Render(ICodeWriter renderer)
        {
            renderer.Write("{0}<", name);

            string placeholders = CodeUtils.Placeholders(GenericArgumentTypes.Count());
            renderer.Write(string.Format("{0}>", placeholders), GenericArgumentTypes.ToArray());
        }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:7,代码来源:GenericType.cs

示例2: Write

#pragma warning disable 1591
        public override void Write(ICodeWriter writer)
        {
            var childIndex = 0;
            var numberOfChildren = Children.Count;

            writer.Write("{{");

            if (numberOfChildren > 0)
            {
                writer.Newline();
                writer.Indent();

                foreach (var child in Children)
                {
                    child.Write(writer);
                    childIndex++;

                    if (childIndex > 0 && childIndex < numberOfChildren)
                        writer.Write(",");
                    writer.Newline();
                }

                writer.Unindent();
                writer.WriteWithIndentation("}}");
            }
            else
            {
                writer.Write("}}");
            }
        }
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:31,代码来源:ObjectLiteral.cs

示例3: Render

        public void Render(ICodeWriter renderer)
        {
            if (!SingleLine)
            {
                renderer.WriteLine("");
                renderer.WriteLine("{");
                renderer.PushIndent();

                foreach (ICode codeLine in codes)
                {
                    renderer.WriteLine("{0}", codeLine);
                }

                renderer.PopIndent();
                renderer.WriteLine("}");
            }
            else
            {
                renderer.Write("{ ");

                foreach (ICode codeLine in codes)
                {
                    renderer.Write("{0}", codeLine);
                }

                renderer.Write(" }");
            }
        }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:28,代码来源:Brace.cs

示例4: Render

 public override void Render(ICodeWriter renderer)
 {
     if(AccessModifier != null)
     {
         renderer.Write("{0} ", AccessModifier);
     }
     renderer.Write(snippet, name, statement);
 }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:8,代码来源:AccesorStatement.cs

示例5: Render

 public override void Render(ICodeWriter renderer)
 {
     foreach (AttributeStatement attribute in attributes)
     {
         renderer.Write("{0} ", attribute);
     }
     renderer.Write(snippet, AccessModifier, Modifier, ReturnType, name, parameterList, body);
 }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:8,代码来源:MethodStatement.cs

示例6: Render

 public void Render(ICodeWriter renderer)
 {
     renderer.Write("[{0}", type);
     if (parameters.Count > 0)
     {
         renderer.Write(string.Format("({0})", CodeUtils.Placeholders(parameters.Count)), parameters.ToArray());
     }
     renderer.Write("]");
 }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:9,代码来源:AttributeStatement.cs

示例7: Render

 public override void Render(ICodeWriter renderer)
 {
     renderer.Write("{0} {1}({2})", AccessModifier, type.GetName(), parameterList);
     if (CallBaseCtor)
     {
         renderer.Write(string.Format(" : base({0})", CodeUtils.Placeholders(baseParameters.Count)), baseParameters.ToArray());
     }
     renderer.Write("{0}", body);
 }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:9,代码来源:ConstructorStatement.cs

示例8: Render

 public override void Render(ICodeWriter renderer)
 {
     renderer.Write("new {0}", type);
     renderer.Write(string.Format("({0})", CodeUtils.Placeholders(parameters.Count)), parameters.ToArray());
     if (initializer.HasInitiCode())
     {
         renderer.Write("{0}", initializer);
     }
 }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:9,代码来源:NewExpression.cs

示例9: Render

 public override void Render(ICodeWriter renderer)
 {
     if (left.IsBool && right.IsBool)
     {
         renderer.Write(snippet, left, ConditionalOperator.And, right);
     }
     else
     {
         renderer.Write(snippet, left, BinaryOperator.And, right);
     }
 }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:11,代码来源:Condition.cs

示例10: Render

 public override void Render(ICodeWriter renderer)
 {
     if (values.Count > 1)
     {
         string placeholders = CodeUtils.Placeholders(values.Count);
         renderer.Write(string.Format("{{ {0} }},", placeholders), values.ToArray());
     }
     else if (values.Count > 0)
     {
         renderer.Write("{0},", values.ToArray());
     }
 }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:12,代码来源:CollectionMemberInitializerExpression.cs

示例11: Render

        public override void Render(ICodeWriter renderer)
        {
            if (caller != null)
            {
                renderer.Write("{0}.", caller);
            }
            renderer.Write(name);
            if (genericArgumentTypes.Count > 0)
            {
                string placeholders = CodeUtils.Placeholders(genericArgumentTypes.Count);
                renderer.Write(string.Format("<{0}>", placeholders), genericArgumentTypes.ToArray());
            }

            renderer.Write(string.Format("({0})", CodeUtils.Placeholders(parameters.Count)), parameters.ToArray());
        }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:15,代码来源:MethodCallExpression.cs

示例12: Render

 public override void Render(ICodeWriter renderer)
 {
     if (!ReferenceEquals(reference, null))
     {
         renderer.Write("{0}.{1}", owner, reference);
     }
     else if (ReferenceEquals(owner, null))
     {
         renderer.Write("{0}", name);
     }
     else
     {
         renderer.Write("{0}.{1}", owner, name);
     }
 }
开发者ID:jorgehmv,项目名称:CsBuilder,代码行数:15,代码来源:MemberExpression.cs

示例13: Write

#pragma warning disable 1591
        public override void Write(ICodeWriter writer)
        {
            writer.Write("function(");
            for (var parameterIndex = 0; parameterIndex < Parameters.Length; parameterIndex++)
            {
                if (parameterIndex != 0)
                    writer.Write(", ");

                writer.Write(Parameters[parameterIndex]);
            }
            writer.Write(") {{");
            writer.Newline();
            Body.Write(writer);
            writer.WriteWithIndentation("}}");
        }
开发者ID:LenFon,项目名称:Bifrost,代码行数:16,代码来源:Function.cs

示例14: Write

#pragma warning disable 1591
        public override void Write(ICodeWriter writer)
        {
            writer.WriteWithIndentation("{0} = ", Name);
            if( Value != null ) Value.Write(writer);
            writer.Write(";");
            writer.Newline();
        }
开发者ID:LenFon,项目名称:Bifrost,代码行数:8,代码来源:AccessorAssignment.cs

示例15: Write

#pragma warning disable 1591
        public override void Write(ICodeWriter writer)
        {
            base.Write(writer);
            if( _extensions.Count > 0 )
            {
                writer.Newline();
                IndentMultiple(writer, 3);
                writer.WriteWithIndentation(".extend({{");
                writer.Newline();
                writer.Indent();

                foreach (var extension in _extensions)
                {
                    if (extension != _extensions[0])
                    {
                        writer.Write(",");
                        writer.Newline();
                    }
                    writer.WriteWithIndentation("{0} : {1}", extension.Name, extension.Options);
                }
                writer.Unindent();
                writer.Newline();
                writer.WriteWithIndentation("}})");
                UnindentMultiple(writer, 3);
            }
        }
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:27,代码来源:Observable.cs


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