1+ using System . Runtime . CompilerServices ;
12using System . Runtime . InteropServices ;
2- using static System . Runtime . CompilerServices . Unsafe ;
33
44namespace DotNext ;
55
6- using ITuple = System . Runtime . CompilerServices . ITuple ;
7-
86/// <summary>
97/// Provides extension methods for tuples.
108/// </summary>
@@ -36,7 +34,7 @@ public static class TupleExtensions
3634
3735 private static Span < T > TupleToSpan < T , TTuple > ( ref TTuple tuple )
3836 where TTuple : struct , ITuple
39- => MemoryMarshal . CreateSpan ( ref As < TTuple , T > ( ref tuple ) , tuple . Length ) ;
37+ => MemoryMarshal . CreateSpan ( ref Unsafe . As < TTuple , T > ( ref tuple ) , tuple . Length ) ;
4038
4139 /// <summary>
4240 /// Obtains a span over tuple items.
@@ -90,7 +88,7 @@ public static Span<T> AsSpan<T>(this ref (T, T) tuple)
9088 /// <typeparam name="T">The type of items in the tuple.</typeparam>
9189 /// <returns>The span over items in the tuple.</returns>
9290 public static ReadOnlySpan < T > AsReadOnlySpan < T > ( this ref readonly ( T , T ) tuple )
93- => TupleToSpan < T , ValueTuple < T , T > > ( ref AsRef ( in tuple ) ) ;
91+ => TupleToSpan < T , ValueTuple < T , T > > ( ref Unsafe . AsRef ( in tuple ) ) ;
9492
9593 /// <summary>
9694 /// Obtains a span over tuple items.
@@ -108,7 +106,7 @@ public static Span<T> AsSpan<T>(this ref (T, T, T) tuple)
108106 /// <typeparam name="T">The type of items in the tuple.</typeparam>
109107 /// <returns>The span over items in the tuple.</returns>
110108 public static ReadOnlySpan < T > AsReadOnlySpan < T > ( this ref readonly ( T , T , T ) tuple )
111- => TupleToSpan < T , ( T , T , T ) > ( ref AsRef ( in tuple ) ) ;
109+ => TupleToSpan < T , ( T , T , T ) > ( ref Unsafe . AsRef ( in tuple ) ) ;
112110
113111 /// <summary>
114112 /// Obtains a span over tuple items.
@@ -126,7 +124,7 @@ public static Span<T> AsSpan<T>(this ref (T, T, T, T) tuple)
126124 /// <typeparam name="T">The type of items in the tuple.</typeparam>
127125 /// <returns>The span over items in the tuple.</returns>
128126 public static ReadOnlySpan < T > AsReadOnlySpan < T > ( this ref readonly ( T , T , T , T ) tuple )
129- => TupleToSpan < T , ( T , T , T , T ) > ( ref AsRef ( in tuple ) ) ;
127+ => TupleToSpan < T , ( T , T , T , T ) > ( ref Unsafe . AsRef ( in tuple ) ) ;
130128
131129 /// <summary>
132130 /// Obtains a span over tuple items.
@@ -144,7 +142,7 @@ public static Span<T> AsSpan<T>(this ref (T, T, T, T, T) tuple)
144142 /// <typeparam name="T">The type of items in the tuple.</typeparam>
145143 /// <returns>The span over items in the tuple.</returns>
146144 public static ReadOnlySpan < T > AsReadOnlySpan < T > ( this ref readonly ( T , T , T , T , T ) tuple )
147- => TupleToSpan < T , ( T , T , T , T , T ) > ( ref AsRef ( in tuple ) ) ;
145+ => TupleToSpan < T , ( T , T , T , T , T ) > ( ref Unsafe . AsRef ( in tuple ) ) ;
148146
149147 /// <summary>
150148 /// Obtains a span over tuple items.
@@ -162,7 +160,7 @@ public static Span<T> AsSpan<T>(this ref (T, T, T, T, T, T) tuple)
162160 /// <typeparam name="T">The type of items in the tuple.</typeparam>
163161 /// <returns>The span over items in the tuple.</returns>
164162 public static ReadOnlySpan < T > AsReadOnlySpan < T > ( this ref readonly ( T , T , T , T , T , T ) tuple )
165- => TupleToSpan < T , ( T , T , T , T , T , T ) > ( ref AsRef ( in tuple ) ) ;
163+ => TupleToSpan < T , ( T , T , T , T , T , T ) > ( ref Unsafe . AsRef ( in tuple ) ) ;
166164
167165 /// <summary>
168166 /// Obtains a span over tuple items.
@@ -180,5 +178,5 @@ public static Span<T> AsSpan<T>(this ref (T, T, T, T, T, T, T) tuple)
180178 /// <typeparam name="T">The type of items in the tuple.</typeparam>
181179 /// <returns>The span over items in the tuple.</returns>
182180 public static ReadOnlySpan < T > AsReadOnlySpan < T > ( this ref readonly ( T , T , T , T , T , T , T ) tuple )
183- => TupleToSpan < T , ( T , T , T , T , T , T , T ) > ( ref AsRef ( in tuple ) ) ;
181+ => TupleToSpan < T , ( T , T , T , T , T , T , T ) > ( ref Unsafe . AsRef ( in tuple ) ) ;
184182}
0 commit comments