Skip to content

Commit

Permalink
Added wrapper extentions for native value types static methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Teodor92 committed Mar 4, 2016
1 parent e7e18fe commit 90a6c4d
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 5 deletions.
5 changes: 0 additions & 5 deletions Source/MoreDotNet/Extentions/StringExtentions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@ public static string ToStringMaximumLength(this string value, int maximumLength,
return value;
}

public static bool IsNullOrEmpty(this string s)
{
return string.IsNullOrEmpty(s);
}

public static int NthIndexOf(this string str, string match, int occurrence)
{
int i = 1;
Expand Down
102 changes: 102 additions & 0 deletions Source/MoreDotNet/Wrappers/DecimalWrappers.cs
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);
}
}
}
25 changes: 25 additions & 0 deletions Source/MoreDotNet/Wrappers/DoubleWrappers.cs
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);
}
}
}
25 changes: 25 additions & 0 deletions Source/MoreDotNet/Wrappers/FloatWrappers.cs
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);
}
}
}
10 changes: 10 additions & 0 deletions Source/MoreDotNet/Wrappers/LongWarppers.cs
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);
}
}
}
25 changes: 25 additions & 0 deletions Source/MoreDotNet/Wrappers/StringWrappers.cs
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);
}
}
}

0 comments on commit 90a6c4d

Please # to comment.