Skip to content

System.Runtime.InteropServices.MemoryMarshall.Write with in parameter #28483

@dzmitry-lahoda

Description

@dzmitry-lahoda

Current:

public static void Write<T>(Span<byte> destination, ref T value)
where T : struct

Proposed:

public static void Write<T>(Span<byte> destination, in T value)
where T : struct

Code example:

var readonlySpan = new ReadOnlySpan<byte>(new byte[1]);
var span = new Span<byte>(new byte[1]);
// assume in does not copy struct
// assume Write does not try to modify struct
MemoryMarshal.Write(span, in readonlySpan[0]); 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions