How would I check if a generic type is unmanaged, then pass it to a method with where T ; unmanaged?
I have a method that needs to call different methods based on whether T is managed or not. I'm not sure how to check if T is unmanaged, and also tell the compiler that it can use it in the method with the unmanaged constraint.
3 Replies
You could, in theory, use a ton of reflection to do it
But you're probably boxing something that shouldn't be boxed if you do
I settled for a very big switch expression
✅ This post has been marked as answered!