Skip to content

Commit 0c84c59

Browse files
committed
fix #4029: Use enum item.Name instead of Enum.GetName to get enum value
This is the propsed fix from the original repo of the code: neuecc/Utf8Json#129
1 parent 39a7d6b commit 0c84c59

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Elasticsearch.Net/Utf8Json/Formatters/EnumFormatter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static EnumFormatter()
166166
foreach (var item in type.GetFields().Where(fi => fi.FieldType == type))
167167
{
168168
var value = item.GetValue(null);
169-
var name = Enum.GetName(type, value);
169+
var name = item.Name;
170170
var dataMember = item.GetCustomAttributes(typeof(DataMemberAttribute), true)
171171
.OfType<DataMemberAttribute>()
172172
.FirstOrDefault();

0 commit comments

Comments
 (0)