Add backwards compatible EnumUtils.TryToString call

This commit is contained in:
James Newton-King
2018-11-27 22:59:02 +13:00
parent 2171a88e5e
commit 82e76365f8
@@ -117,6 +117,13 @@ namespace Newtonsoft.Json.Utilities
return selectedFlagsValues;
}
// Used by Newtonsoft.Json.Schema
private static CamelCaseNamingStrategy _camelCaseNamingStrategy = new CamelCaseNamingStrategy();
public static bool TryToString(Type enumType, object value, bool camelCase, out string name)
{
return TryToString(enumType, value, camelCase ? _camelCaseNamingStrategy : null, out name);
}
public static bool TryToString(Type enumType, object value, NamingStrategy namingStrategy, out string name)
{
EnumInfo enumInfo = ValuesAndNamesPerEnum.Get(new StructMultiKey<Type, NamingStrategy>(enumType, namingStrategy));