mirror of
https://github.com/KevinWG/OSS.Common.git
synced 2026-10-21 17:13:19 +08:00
添加注释
This commit is contained in:
+2
-2
@@ -13,8 +13,8 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C34A14D3-E650-4046-BEC8-3F741AA4678B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C34A14D3-E650-4046-BEC8-3F741AA4678B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C34A14D3-E650-4046-BEC8-3F741AA4678B}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C34A14D3-E650-4046-BEC8-3F741AA4678B}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||
{C34A14D3-E650-4046-BEC8-3F741AA4678B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C34A14D3-E650-4046-BEC8-3F741AA4678B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9F95263C-4F7F-416B-A1B9-D3A0526E2638}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
|
||||
@@ -7,19 +7,23 @@ using System.Text;
|
||||
|
||||
namespace OS.Common.Extention
|
||||
{
|
||||
/// <summary>
|
||||
/// 枚举扩展方法类
|
||||
/// </summary>
|
||||
public static class EnumExtention
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取描述
|
||||
/// </summary>
|
||||
/// <param name="en"></param>
|
||||
/// <param name="en">枚举对象</param>
|
||||
/// <param name="isFlag">是否二进制取和</param>
|
||||
/// <param name="operate">多个描述分隔符</param>
|
||||
/// <returns></returns>
|
||||
public static string GetDesp(this Enum en, bool isFlag = false, string operate = ",")
|
||||
{
|
||||
var values = en.GetType().ToEnumDirs();
|
||||
int current = (int) Enum.Parse(en.GetType(), en.ToString());
|
||||
|
||||
|
||||
|
||||
if (isFlag)
|
||||
{
|
||||
StringBuilder strResult = new StringBuilder();
|
||||
@@ -42,9 +46,7 @@ namespace OS.Common.Extention
|
||||
KeyValuePair<string, string> keypair = values.FirstOrDefault(e => e.Key == current.ToString());
|
||||
return keypair.Key == null ? "不存在的枚举值" : keypair.Value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private static ConcurrentDictionary<string, Dictionary<string, string>> enumDirs
|
||||
=new ConcurrentDictionary<string, Dictionary<string, string>>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user