Skip to content

Commit

Permalink
Add to FlatArrayExtensions factory methods (currently non-public) to …
Browse files Browse the repository at this point in the history
…accord with other factories
  • Loading branch information
andreise committed Aug 23, 2023
1 parent ce1bc4e commit ecdf7c2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ partial class FlatArrayExtensions
public static FlatArray<T> ToFlatArray<T>([AllowNull] this T[] source)
=>
FlatArray<T>.From(source);

// TODO: Add the tests and make public
internal static FlatArray<T> ToFlatArray<T>([AllowNull] this T[] source, int start, int length)
=>
FlatArray<T>.InternalFromArrayChecked(source, start, length);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ public static FlatArray<T> ToFlatArray<T>(this FlatArray<T> source)
=>
FlatArray<T>.From(source);

// TODO: Add the tests and make public
internal static FlatArray<T> ToFlatArray<T>(this FlatArray<T> source, int start, int length)
=>
FlatArray<T>.InternalFromFlatArrayChecked(source, start, length);

public static FlatArray<T> ToFlatArray<T>(this FlatArray<T>? source)
=>
FlatArray<T>.From(source);

// TODO: Add the tests and make public
internal static FlatArray<T> ToFlatArray<T>(this FlatArray<T>? source, int start, int length)
=>
FlatArray<T>.InternalFromFlatArrayChecked(source.GetValueOrDefault(), start, length);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ public static FlatArray<T> ToFlatArray<T>(this ImmutableArray<T> source)
=>
FlatArray<T>.From(source);

// TODO: Add the tests and make public
internal static FlatArray<T> ToFlatArray<T>(this ImmutableArray<T> source, int start, int length)
=>
FlatArray<T>.InternalFromImmutableArrayChecked(source, start, length);

public static FlatArray<T> ToFlatArray<T>(this ImmutableArray<T>? source)
=>
FlatArray<T>.From(source);

// TODO: Add the tests and make public
internal static FlatArray<T> ToFlatArray<T>(this ImmutableArray<T>? source, int start, int length)
=>
FlatArray<T>.InternalFromImmutableArrayChecked(source.GetValueOrDefault(), start, length);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ partial class FlatArrayExtensions
public static FlatArray<T> ToFlatArray<T>([AllowNull] this List<T> source)
=>
FlatArray<T>.From(source);

// TODO: Add the tests and make public
internal static FlatArray<T> ToFlatArray<T>([AllowNull] this List<T> source, int start, int length)
=>
FlatArray<T>.InternalFromListChecked(source, start, length);
}

0 comments on commit ecdf7c2

Please sign in to comment.