'Slow enum parsing when debugging
I have (T)Enum.Parse(typeof(T), inputValue, true); in my extension method to help parsing strings into enums. While this works well and as expected it is utterly slow when debugging. Same situation with generic version of this method: Enum.Parse<MyEnum>(inputValue, true);. When running without debugger attached (Ctrl+F5) all works normally. Is it Visual Studio's issue or there is a reason why it must be so slow?
Solution 1:[1]
Ok, my bad. I found the problem and it wasn't directly caused by Enum.Parse(). My code is reading txt file with ~1000+ lines that contain values I want to parse into enums. When it fails it catches exception and THIS takes about 15ms to process - only when running with debugger attached.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pawel |
