Skip to content

Commit 88582d1

Browse files
mmainermmainer
authored andcommitted
Added the flag attribute for flag enums and the value for all enums.
1 parent 0406b59 commit 88582d1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Templates/CSharp/Model/EnumType.cs.tt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,26 @@ namespace <#=enumT.Namespace.GetNamespaceName()#>
1515
/// The enum <#=enumName#>.
1616
/// </summary>
1717
[JsonConverter(typeof(EnumConverter))]
18+
<# if (enumT.IsFlags == true)
19+
{
20+
#>
21+
[System.Flags]
22+
<#
23+
}
24+
#>
1825
public enum <#=enumName#>
1926
{
2027
<#
21-
foreach(var value in enumT.Members)
28+
foreach(var emumMember in enumT.Members)
2229
{
2330
#>
2431

2532
/// <summary>
26-
/// <#=value.Name.SplitCamelCase()#>
33+
/// <#=emumMember.Name.SplitCamelCase()#>
2734
/// </summary>
28-
<#=value.Name.ToCheckedCase().GetSanitizedPropertyName()#>,
29-
<#
30-
}
35+
<#=emumMember.Name.ToCheckedCase().GetSanitizedPropertyName()#> = <#=emumMember.Value#>,
36+
<#
37+
}
3138
#>
3239

3340
}

0 commit comments

Comments
 (0)