本文整理汇总了C#中IFormatter.WriteDeclaration方法的典型用法代码示例。如果您正苦于以下问题:C# IFormatter.WriteDeclaration方法的具体用法?C# IFormatter.WriteDeclaration怎么用?C# IFormatter.WriteDeclaration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFormatter
的用法示例。
在下文中一共展示了IFormatter.WriteDeclaration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteDeclaration
private void WriteDeclaration(string name, object target, IFormatter formatter)
{
formatter.WriteDeclaration((Array.IndexOf(this.keywords, name) != -1) ? ("&" + name) : name, target);
}
示例2: 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("}");
}
}