本文整理汇总了C#中ICodeBlock.Enum方法的典型用法代码示例。如果您正苦于以下问题:C# ICodeBlock.Enum方法的具体用法?C# ICodeBlock.Enum怎么用?C# ICodeBlock.Enum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICodeBlock
的用法示例。
在下文中一共展示了ICodeBlock.Enum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateEnums
private void GenerateEnums(ICodeBlock codeBlock, BehaviorSave behavior)
{
foreach(var category in behavior.Categories)
{
codeBlock = codeBlock.Enum("public", category.Name);
}
}
示例2: AppendEnum
private static ICodeBlock AppendEnum(ICodeBlock currentBlock, List<StateSave> statesForThisCategory, string enumName, IElement element)
{
if (statesForThisCategory.Count != 0)
{
string prefix = "public";
if (ShouldUseNewKeyword(element, enumName))
{
prefix += " new";
}
currentBlock = currentBlock
.Enum(prefix, enumName)
.Line("Uninitialized = 0, //This exists so that the first set call actually does something")
.Line("Unknown = 1, //This exists so that if the entity is actually a child entity and has set a child state, you will get this");
for (int i = 0; i < statesForThisCategory.Count; i++)
{
string whatToAppend = "";
if (i != statesForThisCategory.Count - 1)
{
whatToAppend += ", ";
}
currentBlock.Line(statesForThisCategory[i].Name + " = " + (i + 2) + whatToAppend);
}
currentBlock = currentBlock.End();
}
return currentBlock;
}