mirror of
https://github.com/sphildreth/roadie
synced 2025-02-17 05:28:28 +00:00
27 lines
No EOL
778 B
C#
27 lines
No EOL
778 B
C#
namespace Roadie.Library.Extensions
|
|
{
|
|
public static class ShortExt
|
|
{
|
|
public static short? Or(this short? value, short? alternative)
|
|
{
|
|
if (!value.HasValue && !alternative.HasValue)
|
|
{
|
|
return null;
|
|
}
|
|
return value.HasValue ? value : alternative;
|
|
}
|
|
|
|
public static short? TakeLarger(this short? value, short? alternative)
|
|
{
|
|
if (!value.HasValue && !alternative.HasValue)
|
|
{
|
|
return null;
|
|
}
|
|
if (!value.HasValue && alternative.HasValue)
|
|
{
|
|
return alternative.Value;
|
|
}
|
|
return value.Value > alternative.Value ? value.Value : alternative.Value;
|
|
}
|
|
}
|
|
} |