Improve performance of Enum.{Try}Parse (dotnet/coreclr#21214)
authorStephen Toub <stoub@microsoft.com>
Thu, 29 Nov 2018 20:59:30 +0000 (15:59 -0500)
committerGitHub <noreply@github.com>
Thu, 29 Nov 2018 20:59:30 +0000 (15:59 -0500)
commit0e9da9b9a4278df34c45ec5e114f916f9e53125f
tree42535cfc5f483ebe1dc2b81547dc201190da4e26
parent3cd25fb39f94f8efedce0bb4786543db0695ba66
Improve performance of Enum.{Try}Parse (dotnet/coreclr#21214)

* Improve performance of Enum.{Try}Parse

In particular for the generic overloads, where this avoids all per-operation allocations when commonly used underlying types are used (for example, this improves when the underlying enum type is int but not double).

* Address PR feedback

Commit migrated from https://github.com/dotnet/coreclr/commit/88fb86f36d22c94cb5fc6424110bf3dac37ac83b
src/coreclr/src/System.Private.CoreLib/src/System/Enum.cs
src/libraries/System.Private.CoreLib/src/System/Char.cs
src/libraries/System.Private.CoreLib/src/System/Number.Parsing.cs