Moved Signal() to MathExtensions

This commit is contained in:
Tiago Garcia 2023-06-09 00:54:44 +01:00
parent 696151a23c
commit 41e1075da6
No known key found for this signature in database
GPG Key ID: F423E37A2415E160
2 changed files with 15 additions and 11 deletions

View File

@ -1,17 +1,7 @@
namespace AdventOfCode.Utils; namespace AdventOfCode.Utils;
public static class Extensions public static class LinqExtensions
{ {
public static int Signal(this int x)
{
return x switch
{
< 0 => -1,
> 0 => 1,
_ => 0
};
}
/// <summary> /// <summary>
/// Returns a slice of the given list /// Returns a slice of the given list
/// </summary> /// </summary>

14
Utils/MathExtensions.cs Normal file
View File

@ -0,0 +1,14 @@
namespace AdventOfCode.Utils;
public static class MathExtensions
{
public static int Signal(this int x)
{
return x switch
{
< 0 => -1,
> 0 => 1,
_ => 0
};
}
}