mirror of
https://github.com/AlexMacocian/SystemExtensions.git
synced 2026-07-22 17:19:30 +00:00
Added various extensions.
Added coding style helpers. Unit tests.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
namespace System.Extensions
|
||||
{
|
||||
public static class CastExtensions
|
||||
{
|
||||
public static int Floor(this double value)
|
||||
{
|
||||
return (int)Math.Floor(value);
|
||||
}
|
||||
|
||||
public static int Ceiling(this double value)
|
||||
{
|
||||
return (int)Math.Ceiling(value);
|
||||
}
|
||||
|
||||
public static int Round(this double value)
|
||||
{
|
||||
return (int)Math.Round(value);
|
||||
}
|
||||
|
||||
public static int Floor(this float value)
|
||||
{
|
||||
return (int)Math.Floor(value);
|
||||
}
|
||||
|
||||
public static int Ceiling(this float value)
|
||||
{
|
||||
return (int)Math.Ceiling(value);
|
||||
}
|
||||
|
||||
public static int Round(this float value)
|
||||
{
|
||||
return (int)Math.Round(value);
|
||||
}
|
||||
|
||||
public static int ToInt(this double value)
|
||||
{
|
||||
return (int)value;
|
||||
}
|
||||
|
||||
public static int ToInt(this float value)
|
||||
{
|
||||
return (int)value;
|
||||
}
|
||||
|
||||
public static int ToInt(this decimal value)
|
||||
{
|
||||
return (int)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user