本文整理汇总了C#中IFormatter.WriteComment方法的典型用法代码示例。如果您正苦于以下问题:C# IFormatter.WriteComment方法的具体用法?C# IFormatter.WriteComment怎么用?C# IFormatter.WriteComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFormatter
的用法示例。
在下文中一共展示了IFormatter.WriteComment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteSnippetExpression
private void WriteSnippetExpression(ISnippetExpression expression, IFormatter formatter)
{
formatter.WriteComment(expression.Value);
}
示例2: WriteTypeVisibility
public void WriteTypeVisibility(TypeVisibility visibility, IFormatter formatter)
{
switch (visibility)
{
case TypeVisibility.Public: formatter.WriteKeyword("public"); break;
case TypeVisibility.NestedPublic: formatter.WriteKeyword("public"); break;
case TypeVisibility.Private: formatter.WriteKeyword("strict private"); break;
case TypeVisibility.NestedAssembly: formatter.WriteKeyword("private"); break;
case TypeVisibility.NestedPrivate: formatter.WriteKeyword("strict private"); break;
case TypeVisibility.NestedFamily: formatter.WriteKeyword("strict protected"); break;
case TypeVisibility.NestedFamilyAndAssembly: formatter.WriteKeyword("protected"); break;
case TypeVisibility.NestedFamilyOrAssembly: formatter.WriteKeyword("protected");
formatter.Write(" ");
formatter.WriteComment("{internal}"); break;
default: throw new NotSupportedException();
}
formatter.Write(" ");
}
示例3: 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();
}
}