本文整理汇总了C#中IFormatter.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# IFormatter.WriteLine方法的具体用法?C# IFormatter.WriteLine怎么用?C# IFormatter.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFormatter
的用法示例。
在下文中一共展示了IFormatter.WriteLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteQueryContinuation
private void WriteQueryContinuation(IQueryContinuation value, IFormatter formatter)
{
formatter.WriteKeyword("into");
formatter.Write(" ");
this.WriteDeclaration(value.Variable.Name, formatter);
formatter.WriteLine();
this.WriteQueryBody(value.Body, formatter);
}
示例2: WriteQueryExpression
private void WriteQueryExpression(IQueryExpression value, IFormatter formatter)
{
formatter.Write("(");
this.WriteFromClause(value.From, formatter);
if ((value.Body.Clauses.Count > 0) || (value.Body.Continuation != null))
{
formatter.WriteLine();
formatter.WriteIndent();
}
else
{
formatter.Write(" ");
}
this.WriteQueryBody(value.Body, formatter);
formatter.Write(")");
if ((value.Body.Clauses.Count > 0) || (value.Body.Continuation != null))
{
formatter.WriteOutdent();
}
}
示例3: WriteBlockExpression
private void WriteBlockExpression(IBlockExpression expression, IFormatter formatter)
{
formatter.Write("[");
if (expression.Expressions.Count > 16)
{
formatter.WriteLine();
formatter.WriteIndent();
}
for (int i = 0; i < expression.Expressions.Count; i++)
{
if (i != 0)
{
formatter.Write(", ");
if ((i % 16) == 0)
{
formatter.WriteLine();
}
}
this.WriteExpression(expression.Expressions[i], formatter);
}
if (expression.Expressions.Count > 16)
{
formatter.WriteOutdent();
formatter.WriteLine();
}
formatter.Write("]");
}
示例4: WriteQueryBody
private void WriteQueryBody(IQueryBody value, IFormatter formatter)
{
// from | where | let | join | orderby
for (int i = 0; i < value.Clauses.Count; i++)
{
this.WriteQueryClause(value.Clauses[i], formatter);
formatter.WriteLine();
}
// select | group
this.WriteQueryOperation(value.Operation, formatter);
// into
if (value.Continuation != null)
{
formatter.Write(" ");
this.WriteQueryContinuation(value.Continuation, formatter);
}
}
示例5: WriteTryCatchFinallyStatement
private void WriteTryCatchFinallyStatement(ITryCatchFinallyStatement statement, IFormatter formatter)
{
this.WriteStatementSeparator(formatter);
formatter.WriteKeyword("try");
formatter.Write(" {");
formatter.WriteLine();
formatter.WriteIndent();
if (statement.Try != null)
{
this.WriteStatement(statement.Try, formatter);
this.WritePendingOutdent(formatter);
}
else
{
formatter.WriteLine();
}
formatter.WriteOutdent();
formatter.Write("}");
this.firstStmt = true;
foreach (ICatchClause catchClause in statement.CatchClauses)
{
formatter.WriteLine();
formatter.WriteKeyword("catch");
formatter.Write(" (");
formatter.WriteDeclaration(catchClause.Variable.Name);
formatter.Write(")");
formatter.Write(" {");
formatter.WriteLine();
formatter.WriteIndent();
if (catchClause.Condition != null)
{
formatter.Write(" ");
formatter.WriteKeyword("if");
formatter.Write(" ");
this.WriteExpression(catchClause.Condition, formatter);
formatter.Write(" ");
formatter.WriteKeyword("then");
}
if (catchClause.Body != null)
{
this.WriteStatement(catchClause.Body, formatter);
}
else
{
formatter.WriteLine();
}
formatter.WriteOutdent();
formatter.Write("}");
}
if ((statement.Finally != null) && (statement.Finally.Statements.Count > 0))
{
formatter.WriteLine();
formatter.WriteKeyword("finally");
formatter.Write(" {");
formatter.WriteLine();
formatter.WriteIndent();
if (statement.Finally != null)
{
this.WriteStatement(statement.Finally, formatter);
this.WritePendingOutdent(formatter);
}
else
{
formatter.WriteLine();
}
formatter.WriteOutdent();
formatter.Write("}");
}
}
示例6: WriteVariableDeclaration
private void WriteVariableDeclaration(IVariableDeclaration variableDeclaration, IFormatter formatter)
{
formatter.WriteKeyword("var ");
this.WriteDeclaration(variableDeclaration.Name, formatter); // TODO Escape = true
if (!this.forLoop)
{
formatter.Write(";");
formatter.WriteLine();
}
}
示例7: WriteFixedStatement
private void WriteFixedStatement(IFixedStatement statement, IFormatter formatter)
{
this.WriteStatementSeparator(formatter);
formatter.WriteKeyword("fixed");
formatter.Write(" ");
formatter.Write("(");
this.WriteVariableDeclaration(statement.Variable, formatter);
formatter.Write(" ");
formatter.WriteKeyword("=");
formatter.Write(" ");
this.WriteExpression(statement.Expression, formatter);
formatter.Write(")");
formatter.WriteLine();
formatter.WriteKeyword("begin");
formatter.WriteLine();
formatter.WriteIndent();
if (statement.Body != null)
{
this.WriteBlockStatement(statement.Body, formatter);
}
formatter.WriteOutdent();
formatter.WriteKeyword("end ");
}
示例8: WriteSwitchCaseCondition
private void WriteSwitchCaseCondition(IExpression condition, IFormatter formatter)
{
IBinaryExpression binaryExpression = condition as IBinaryExpression;
if ((binaryExpression != null) && (binaryExpression.Operator == BinaryOperator.BooleanOr))
{
this.WriteSwitchCaseCondition(binaryExpression.Left, formatter);
this.WriteSwitchCaseCondition(binaryExpression.Right, formatter);
}
else
{
formatter.WriteKeyword("case ");
this.WriteExpression(condition, formatter);
formatter.Write(":");
formatter.WriteLine();
}
}
示例9: WriteContinueStatement
private void WriteContinueStatement(IContinueStatement statement, IFormatter formatter)
{
this.WriteStatementSeparator(formatter);
formatter.WriteKeyword("continue");
formatter.Write(";");
formatter.WriteLine();
}
示例10: WriteCustomAttributeList
private void WriteCustomAttributeList(ICustomAttributeProvider provider, IFormatter formatter)
{
ArrayList attributes = new ArrayList();
for (int i = 0; i < provider.Attributes.Count; i++)
{
ICustomAttribute attribute = provider.Attributes[i];
if (IsType(attribute.Constructor.DeclaringType, "System.Runtime.InteropServices", "DefaultParameterValueAttribute", "System"))
{
continue;
}
attributes.Add(attribute);
}
if (attributes.Count > 0)
{
string prefix = null;
IAssembly assembly = provider as IAssembly;
if (assembly != null)
{
prefix = "assembly:";
}
IModule module = provider as IModule;
if (module != null)
{
prefix = "module:";
}
IMethodReturnType methodReturnType = provider as IMethodReturnType;
if (methodReturnType != null)
{
prefix = "return:";
}
if ((assembly != null) || (module != null))
{
for (int i = 0; i < attributes.Count; i++)
{
ICustomAttribute attribute = (ICustomAttribute)attributes[i];
formatter.Write("[");
formatter.WriteKeyword(prefix);
formatter.Write(" ");
this.WriteCustomAttribute(attribute, formatter);
formatter.Write("]");
if (i != (attributes.Count - 1))
{
formatter.WriteLine();
}
}
}
else
{
formatter.Write("[");
if (prefix != null)
{
formatter.WriteKeyword(prefix);
formatter.Write(" ");
}
for (int i = 0; i < attributes.Count; i++)
{
if (i != 0)
{
formatter.Write(", ");
}
ICustomAttribute attribute = (ICustomAttribute)attributes[i];
this.WriteCustomAttribute(attribute, formatter);
}
formatter.Write("]");
}
}
}
示例11: WriteConditionStatement
private void WriteConditionStatement(IConditionStatement statement, IFormatter formatter)
{
this.WriteStatementSeparator(formatter);
formatter.WriteKeyword("if");
formatter.Write(" ");
if (statement.Condition is IBinaryExpression)
this.WriteExpression(statement.Condition, formatter);
else
{
formatter.Write("(");
this.WriteExpression(statement.Condition, formatter);
formatter.Write(")");
}
formatter.Write(" {");
formatter.WriteLine();
formatter.WriteIndent();
if (statement.Then != null)
this.WriteStatement(statement.Then, formatter);
else
formatter.WriteLine();
formatter.WriteOutdent();
formatter.Write("}");
if ((statement.Else != null) && (statement.Else.Statements.Count > 0))
{
this.WritePendingOutdent(formatter);
formatter.WriteLine();
formatter.WriteKeyword("else");
formatter.Write(" {");
formatter.WriteLine();
formatter.WriteIndent();
if (statement.Else != null)
{
this.WriteStatement(statement.Else, formatter);
this.WritePendingOutdent(formatter);
}
else
{
formatter.WriteLine();
}
formatter.WriteOutdent();
formatter.Write("}");
}
}
示例12: WriteComment
private void WriteComment(IComment comment, IFormatter formatter)
{
string[] parts = comment.Text.Split(new char[] { '\n' });
if (parts.Length <= 1)
{
foreach (string part in parts)
{
formatter.WriteComment("// ");
formatter.WriteComment(part);
formatter.WriteLine();
}
}
else
{
formatter.WriteComment("/* ");
formatter.WriteLine();
foreach (string part in parts)
{
formatter.WriteComment(part);
formatter.WriteLine();
}
formatter.WriteComment("*/");
formatter.WriteLine();
}
}
示例13: WriteBreakStatement
private void WriteBreakStatement(IBreakStatement statement, IFormatter formatter)
{
this.WriteStatementSeparator(formatter);
formatter.WriteKeyword("break");
formatter.Write(";");
formatter.WriteLine();
}
示例14: WriteRemoveEventStatement
private void WriteRemoveEventStatement(IRemoveEventStatement statement, IFormatter formatter)
{
this.WriteStatementSeparator(formatter);
this.WriteEventReferenceExpression(statement.Event, formatter);
formatter.Write(" -= ");
this.WriteExpression(statement.Listener, formatter);
formatter.Write(";");
formatter.WriteLine();
}
示例15: WriteForEachStatement
private void WriteForEachStatement(IForEachStatement value, IFormatter formatter)
{
// TODO statement.Variable declaration needs to be rendered some where
this.WriteStatementSeparator(formatter);
TextFormatter description = new TextFormatter();
this.WriteVariableDeclaration(value.Variable, description);
formatter.WriteLine();
formatter.WriteKeyword("foreach");
formatter.Write(" (");
formatter.WriteReference(value.Variable.Name, description.ToString(), null);
formatter.WriteKeyword(" in ");
this.WriteExpression(value.Expression, formatter);
formatter.Write(") {");
formatter.WriteLine();
formatter.WriteIndent();
if (value.Body != null)
{
this.WriteStatement(value.Body, formatter);
}
formatter.WriteLine();
formatter.WriteOutdent();
formatter.WriteKeyword("}");
}