.NET API 366,080 bytes
TupleExtensions
Provides extension methods for tuples.
using System;
using System.
Runtime.
CompilerServices;
namespace DotNext
{
public static class TupleExtensions
{
[
System.
Runtime.
CompilerServices.
NullableContext(
1)]
[
return:
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
1,
2
})]
public static object[]
ToArray<
T>(
this T tuple)
where T :
ITuple
{
object[]
array;
if (
tuple.
Length >
0) {
array =
new object[
tuple.
Length];
for (
int i =
0;
i <
array.
Length;
i++) {
array[
i] =
tuple[
i];
}
}
else
array =
Array.
Empty<
object>();
return array;
}
}
}