Skip to content

Q: Have Span<T> and Memory<T> evolved? #28926

@JPKusumi

Description

@JPKusumi

I ask this because I read Stephen Toub's article, 'All About Span: Exploring a New .NET Mainstay'. It says, "This article has been updated to reflect technical changes following its publication."

And yet, there may be two stories in circulation 'out there'. In Story dotnet/corefx#1, Span is only for items on the stack, and Memory may be used for items on the heap. That's the sense that I got from the Toub article.

Story dotnet/corefx#2 comes to me from Code Magazine; here's a link to an article by Ahson A. Khan:
https://www.codemag.com/article/1807051/Introducing-.NET-Core-2.1-Flagship-Types-Span-T-and-Memory-T

The first example in Khan's article speaks of "an array of bytes allocated somewhere on the heap", and it proceeds to use Span to access it.

These two stories cannot both be correct. Is Toub wrong? Is Khan wrong? Or, did Span evolve so that an older story went out of date? Which idea should be deprecated? TYVM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.MemoryquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions