Skip to content

Lack of Operations for InlineArray #95741

Answered by gfoidl
yuyang9119 asked this question in General
Discussion options

You must be logged in to vote

InlineArray is a struct, so just "clear" it with myInlineArray = default.
Or access it as span and use Span.Clear-method.

For you other operator-wishes also just use span, e.g.

using System.Runtime.CompilerServices;

Foo foo = new();
foo[3] = 42;
foo[9] = 3;

Span<int> span = foo;
span.Sort();

for (int i = 0; i < span.Length; ++i)
{
    Console.WriteLine(span[i]);
}

[InlineArray(10)]
public struct Foo
{
    private int _value;
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by yuyang9119
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants