0 votes
in Dot Net by
Stackalloc in nested expressions in C#

1 Answer

0 votes
by

Starting with C# 8.0, if the result of a stackalloc expression is of the System.Span<T> or System.ReadOnlySpan<T> type, you can use the stackalloc expression in other expressions:

Span<int> numbers = stackalloc[] { 1, 2, 3, 4, 5, 6 }; var ind = numbers.IndexOfAny(stackalloc[] { 2, 4, 6 ,8 }); Console.WriteLine(ind); // output: 1

Related questions

0 votes
asked Dec 8, 2019 in Dot Net by Sinaya
0 votes
asked Dec 8, 2019 in Dot Net by Sinaya
0 votes
0 votes
asked Dec 8, 2019 in Dot Net by Sinaya
0 votes
0 votes
asked Dec 8, 2019 in Dot Net by Sinaya
...