honey the codewitch
Looking for a better way to cancel on keypress from the console
I'm using the following code to trigger a cancellation token when the user presses a key. I had to use a thread, because some of these operations are long running, so I can't just check for keypresses between async calls. I feel like there has to be a better way than spawning a thread, but it's just not coming to me.
That's an excerpt. The whole code is here: https://pastebin.com/Cpu18pYm
45 replies
How to get a Type by string without specifying the assembly name, if it's among loaded asms
Okay, it's been forever since I had to do this in C#, but I need to get a Type by name without having to specify the assembly name, if it is among the currently loaded assemblies for the app domain. What's the best way to do this. Basically I want it to do what Type.GetType() does but a bit more permissive in that it searches all loaded assemblies instead of just the calling assembly when it comes to nonqualified names
3 replies