-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improving constraint for BitHelper #20
Comments
Thanks for bringing this to my attention. I hadn't seen this yet. I'll look to implement in the next release along with all the handle changes. If you have time to do a PR for this, I'd be very appreciative. |
Did you use IConvertible in other places where thr meaning was unmanaged constraint ? |
I tried to follow the pattern using |
In this particular BitHelper extension, I was attempting to constrain to the set of items that could be converted to a number. |
So BitHelper definitely should use unmanaged to cover all blittable types. |
Actually if I understand correctly BitHelper is intended for types smaller or equal than Int64 ? Is it correct ? |
There is also possible NRE since you can pass null in 'bits' parameter. |
To simplify and help make more foolproof, I have extended the list of constraints to |
Just wondering, did you want to specify T : unmanaged perhaps ?
Check here:
https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/generics/constraints-on-type-parameters
https://blogs.msdn.microsoft.com/seteplia/2018/06/12/dissecting-new-generics-constraints-in-c-7-3/
The text was updated successfully, but these errors were encountered: