Lack of Operations for InlineArray #95741
Answered
by
gfoidl
yuyang9119
asked this question in
General
-
Static methods in |
Beta Was this translation helpful? Give feedback.
Answered by
gfoidl
Dec 7, 2023
Replies: 1 comment
-
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;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
yuyang9119
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
InlineArray
is a struct, so just "clear" it withmyInlineArray = default
.Or access it as span and use
Span.Clear
-method.For you other operator-wishes also just use span, e.g.