-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added wrapper extentions for native value types static methods
- Loading branch information
Showing
6 changed files
with
187 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
namespace MoreDotNet.Wrappers | ||
{ | ||
using System; | ||
|
||
public static class DecimalWrappers | ||
{ | ||
public static decimal Ceiling(this decimal input) | ||
{ | ||
return decimal.Ceiling(input); | ||
} | ||
|
||
public static decimal Floor(this decimal input) | ||
{ | ||
return decimal.Floor(input); | ||
} | ||
|
||
public static long ToOaCurrency(this decimal input) | ||
{ | ||
return decimal.ToOACurrency(input); | ||
} | ||
|
||
public static byte ToByte(this decimal input) | ||
{ | ||
return decimal.ToByte(input); | ||
} | ||
|
||
public static sbyte ToSByte(this decimal input) | ||
{ | ||
return decimal.ToSByte(input); | ||
} | ||
|
||
public static short ToShort(this decimal input) | ||
{ | ||
return decimal.ToInt16(input); | ||
} | ||
|
||
public static ushort ToUShort(this decimal input) | ||
{ | ||
return decimal.ToUInt16(input); | ||
} | ||
|
||
public static int ToInt(this decimal input) | ||
{ | ||
return decimal.ToInt32(input); | ||
} | ||
|
||
public static uint ToUInt(this decimal input) | ||
{ | ||
return decimal.ToUInt32(input); | ||
} | ||
|
||
public static long ToLong(this decimal input) | ||
{ | ||
return decimal.ToInt64(input); | ||
} | ||
|
||
public static ulong ToULong(this decimal input) | ||
{ | ||
return decimal.ToUInt64(input); | ||
} | ||
|
||
public static float ToFloat(this decimal input) | ||
{ | ||
return decimal.ToSingle(input); | ||
} | ||
|
||
public static double ToDouble(this decimal input) | ||
{ | ||
return decimal.ToDouble(input); | ||
} | ||
|
||
public static int[] GetBits(this decimal input) | ||
{ | ||
return decimal.GetBits(input); | ||
} | ||
|
||
public static decimal Round(this decimal input) | ||
{ | ||
return decimal.Round(input); | ||
} | ||
|
||
public static decimal Round(this decimal input, int decimals) | ||
{ | ||
return decimal.Round(input, decimals); | ||
} | ||
|
||
public static decimal Round(this decimal input, int decimals, MidpointRounding mode) | ||
{ | ||
return decimal.Round(input, decimals, mode); | ||
} | ||
|
||
public static decimal Round(this decimal input, MidpointRounding mode) | ||
{ | ||
return decimal.Round(input, mode); | ||
} | ||
|
||
public static decimal Truncate(this decimal input) | ||
{ | ||
return decimal.Truncate(input); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace MoreDotNet.Wrappers | ||
{ | ||
public static class DoubleWrappers | ||
{ | ||
public static bool IsNaN(this double input) | ||
{ | ||
return double.IsNaN(input); | ||
} | ||
|
||
public static bool IsInfinity(this double input) | ||
{ | ||
return double.IsInfinity(input); | ||
} | ||
|
||
public static bool IsNegativeInfinity(this double input) | ||
{ | ||
return double.IsNegativeInfinity(input); | ||
} | ||
|
||
public static bool IsPositiveInfinity(this double input) | ||
{ | ||
return double.IsPositiveInfinity(input); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace MoreDotNet.Wrappers | ||
{ | ||
public static class FloatWrappers | ||
{ | ||
public static bool IsNaN(this float input) | ||
{ | ||
return double.IsNaN(input); | ||
} | ||
|
||
public static bool IsInfinity(this double input) | ||
{ | ||
return double.IsInfinity(input); | ||
} | ||
|
||
public static bool IsNegativeInfinity(this double input) | ||
{ | ||
return double.IsNegativeInfinity(input); | ||
} | ||
|
||
public static bool IsPositiveInfinity(this double input) | ||
{ | ||
return double.IsPositiveInfinity(input); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace MoreDotNet.Wrappers | ||
{ | ||
public static class LongWarppers | ||
{ | ||
public static decimal FromOaCurrency(this long input) | ||
{ | ||
return decimal.FromOACurrency(input); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace MoreDotNet.Wrappers | ||
{ | ||
public static class StringWrappers | ||
{ | ||
public static bool IsNullOrWhiteSpace(this string input) | ||
{ | ||
return string.IsNullOrWhiteSpace(input); | ||
} | ||
|
||
public static bool IsNullOrEmpty(this string s) | ||
{ | ||
return string.IsNullOrEmpty(s); | ||
} | ||
|
||
public static string IsInterned(this string s) | ||
{ | ||
return string.IsInterned(s); | ||
} | ||
|
||
public static string Intern(this string s) | ||
{ | ||
return string.Intern(s); | ||
} | ||
} | ||
} |