-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7f856a
commit c6771a0
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace EntityFrameWork.Server.Helper | ||
{ | ||
/// <summary> | ||
/// 获取枚举键、值 | ||
/// </summary> | ||
public class EnumHelper | ||
{ | ||
|
||
public IEnumerable<EnumReault> Get<T>(T enum_item) | ||
{ | ||
List<EnumReault> enum_list = new List<EnumReault>(); | ||
var values = Enum.GetValues(typeof(T)); | ||
foreach (var item in values) | ||
{ | ||
enum_list.Add(new EnumReault { text = Enum.GetName(typeof(T), item), value =item }); | ||
} | ||
return enum_list; | ||
} | ||
} | ||
public class EnumReault | ||
{ | ||
public string text { get; set; } | ||
|
||
public object value { get; set; } | ||
} | ||
} |