-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCsSecurityExtensions.cs
More file actions
61 lines (52 loc) · 1.97 KB
/
CsSecurityExtensions.cs
File metadata and controls
61 lines (52 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//*****************************************************************************
//* Code Factory SDK
//* Copyright (c) 2022 CodeFactory, LLC
//*****************************************************************************
using CodeFactory.DotNet.CSharp;
using CodeFactory.DotNet.CSharp.FormattedSyntax;
namespace CodeFactory.Formatting.CSharp
{
/// <summary>
/// Extensions class that provides common automation tasks rolled up under standard extension methods that support the <see cref="CsSecurity"/> model.
/// </summary>
public static class CsSecurityExtensions
{
/// <summary>
/// Gets the security keyword for the C# language.
/// </summary>
/// <param name="source">The source security object to get the keyword from.</param>
/// <returns>The name of the security keyword or null.</returns>
public static string CSharpFormatKeyword(this CsSecurity source)
{
string result;
switch (source)
{
case CsSecurity.Public:
result = Security.Public;
break;
case CsSecurity.Protected:
result = Security.Protected;
break;
case CsSecurity.Internal:
result = Security.Internal;
break;
case CsSecurity.Private:
result = Security.Private;
break;
case CsSecurity.ProtectedInternal:
result = Security.ProtectedInternal;
break;
case CsSecurity.ProtectedOrInternal:
result = Security.PrivateProtected;
break;
case CsSecurity.Unknown:
result = null;
break;
default:
result = null;
break;
}
return result;
}
}
}