runtime
runtime copied to clipboard
[API Proposal]: Introduce BinaryData.Length
Background and motivation
There is currently no intuitive way of getting the length of BinaryData, using a workaround ToArray or ToMemory it is not easy to assume it will not allocate anything.
API Proposal
namespace System;
public class BinaryData
{
public int Length { get; }
}
API Usage
var b = new BinaryData(new byte[] { 1, 2, 3, 4 });
Console.WriteLine(b.Length);
Alternative Designs
No response
Risks
No response
Tagging subscribers to this area: @dotnet/area-system-memory See info in area-owners.md if you want to be subscribed.
Issue Details
Background and motivation
There is currently no intuitive way of getting the length of BinaryData, using a workaround ToArray or ToMemory it is not easy to assume it will not allocate anything.
API Proposal
namespace System;
public class BinaryData
{
public int Length { get; }
}
API Usage
var b = new BinaryData(new byte[] { 1, 2, 3, 4 });
Console.WriteLine(b.Length);
Alternative Designs
No response
Risks
No response
| Author: | lilinus |
|---|---|
| Assignees: | - |
| Labels: |
|
| Milestone: | - |
Oh i saw this exists in .NET 8 now....