Hopefully add documentation to nuget package.
All checks were successful
Build NuGet / build (push) Successful in 41s

This commit is contained in:
2026-04-08 22:14:08 -04:00
parent d0968e1586
commit b91111eaa5
4 changed files with 37 additions and 2 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,2 @@
obj obj
bin bin
.packages

View File

@@ -1,9 +1,44 @@
namespace SJK.Functional; namespace SJK.Functional;
/// <summary>
/// Provides methods to convert values into tuples.
/// </summary>
public static class TupleExtensions public static class TupleExtensions
{ {
/// <summary>
/// Converts two values of any type into a tuple.
/// </summary>
/// <typeparam name="T1">The type of the first value.</typeparam>
/// <typeparam name="T2">The type of the second value.</typeparam>
/// <param name="first">The first value to convert.</param>
/// <param name="second">The second value to convert.</param>
/// <returns>A tuple containing both values.</returns>
public static (T1, T2) ToTuple<T1, T2>(this T1 first, T2 second) => (first, second); public static (T1, T2) ToTuple<T1, T2>(this T1 first, T2 second) => (first, second);
/// <summary>
/// Converts three values of any type into a tuple.
/// </summary>
/// <typeparam name="T1">The type of the first value.</typeparam>
/// <typeparam name="T2">The type of the second value.</typeparam>
/// <typeparam name="T3">The type of the third value.</typeparam>
/// <param name="first">The first value to convert.</param>
/// <param name="second">The second value to convert.</param>
/// <param name="third">The third value to convert.</param>
/// <returns>A tuple containing all three values.</returns>
public static (T1, T2, T3) ToTuple<T1, T2, T3>(this T1 first, T2 second, T3 third) => (first, second, third); public static (T1, T2, T3) ToTuple<T1, T2, T3>(this T1 first, T2 second, T3 third) => (first, second, third);
/// <summary>
/// Converts four values of any type into a tuple.
/// </summary>
/// <typeparam name="T1">The type of the first value.</typeparam>
/// <typeparam name="T2">The type of the second value.</typeparam>
/// <typeparam name="T3">The type of the third value.</typeparam>
/// <typeparam name="T4">The type of the fourth value.</typeparam>
/// <param name="first">The first value to convert.</param>
/// <param name="second">The second value to convert.</param>
/// <param name="third">The third value to convert.</param>
/// <param name="forth">The fourth value to convert.</param>
/// <returns>A tuple containing all four values.</returns>
public static (T1, T2, T3, T4) ToTuple<T1, T2, T3, T4>(this T1 first, T2 second, T3 third, T4 forth) => (first, second, third, forth); public static (T1, T2, T3, T4) ToTuple<T1, T2, T3, T4>(this T1 first, T2 second, T3 third, T4 forth) => (first, second, third, forth);
} }

0
README.md Normal file
View File

View File

@@ -5,6 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>
</Project> </Project>