generated from RageAgainstThePixel/upm-template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added http method to debug info - added EnumExtensions to convert enum member values to string - updated editor to 2022.3.16f1 LTS
- Loading branch information
1 parent
6374dcf
commit 5fd4c5b
Showing
8 changed files
with
204 additions
and
168 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
23 changes: 23 additions & 0 deletions
23
Utilities.Rest/Packages/com.utilities.rest/Runtime/Extensions/EnumExtensions.cs
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,23 @@ | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
using System; | ||
|
||
namespace Utilities.Rest | ||
{ | ||
public static class EnumExtensions | ||
{ | ||
private static readonly JsonSerializerSettings settings = new JsonSerializerSettings | ||
{ | ||
Converters = { new StringEnumConverter() } | ||
}; | ||
|
||
public static string ToEnumMemberString<T>(this T value) where T : Enum | ||
{ | ||
const string empty = ""; | ||
const string quote = "\""; | ||
return JsonConvert.SerializeObject(value, settings).Replace(quote, empty); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Utilities.Rest/Packages/com.utilities.rest/Runtime/Extensions/EnumExtensions.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Oops, something went wrong.