-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add Guid.GetBytes(byte[]) and Decimal.GetBits(decimal d, byte[]) #18969
Comments
Moved from CoreCLR as it's an API addition. Please use the following general rule-of-thumb for choosing the right repo to make your change (start by creating an issue): |
We need formal API proposal |
I see there's a couple specific requests for this, but it's more of a general problem. Should we look at all functions that can copy to new arrays and consider adding overloads that copy to an existing array? |
Yes 😄 |
We should probably wait first for the For tracking the more general issue, I would suggest filing a new issue with list of all such APIs. (someone needs to do a larger sweep) We can then decide to close this one. |
Why do we need to wait for the Span design to complete. In this case as well as in the cases where we use StringBuilders under the hood, enabling an overload that lets people pass in the array or StringBuilder to use instead seems like a good improvement to the API. Would we wait for Span to see if thats what we want to enable passing to the overload? |
Yes, that's the idea. |
It sounds like the first step would be to identify all the types where we would like to have these additions on. Anyone interested? |
Moved tracking to dotnet/corefx#13892. |
@davidfowl commented on Sun Sep 18 2016
Today the supported way to get the
byte[]
representation of a guid is to use ToByteArray() https://github.com/dotnet/coreclr/blob/master/src/mscorlib/src/System/Guid.cs#L893, which allocates a byte[]. Instead it would be great if there was an overload that could write into an existingbyte[]
@mikedn commented on Mon Sep 19 2016
Guid.GetBytes(Span<byte>)
?@davidfowl commented on Sun Sep 25 2016
Would be even better. When
Span<T>
existsThe text was updated successfully, but these errors were encountered: