mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-10 05:55:41 +00:00
(#39) Use inline ternary instead of cast
This commit is contained in:
parent
ef78f86b3a
commit
5dab9323b6
@ -62,7 +62,7 @@ namespace X10D.BooleanExtensions
|
|||||||
/// </example>
|
/// </example>
|
||||||
public static decimal ToDecimal(this bool value)
|
public static decimal ToDecimal(this bool value)
|
||||||
{
|
{
|
||||||
return value.ToByte();
|
return value ? 1.0m : 0.0m;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -86,7 +86,7 @@ namespace X10D.BooleanExtensions
|
|||||||
/// </example>
|
/// </example>
|
||||||
public static double ToDouble(this bool value)
|
public static double ToDouble(this bool value)
|
||||||
{
|
{
|
||||||
return value.ToByte();
|
return value ? 1.0 : 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -112,7 +112,7 @@ namespace X10D.BooleanExtensions
|
|||||||
/// </example>
|
/// </example>
|
||||||
public static short ToInt16(this bool value)
|
public static short ToInt16(this bool value)
|
||||||
{
|
{
|
||||||
return value.ToByte();
|
return value ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -138,7 +138,7 @@ namespace X10D.BooleanExtensions
|
|||||||
/// </example>
|
/// </example>
|
||||||
public static int ToInt32(this bool value)
|
public static int ToInt32(this bool value)
|
||||||
{
|
{
|
||||||
return value.ToByte();
|
return value ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -164,7 +164,7 @@ namespace X10D.BooleanExtensions
|
|||||||
/// </example>
|
/// </example>
|
||||||
public static long ToInt64(this bool value)
|
public static long ToInt64(this bool value)
|
||||||
{
|
{
|
||||||
return value.ToByte();
|
return value ? 1L : 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -190,7 +190,7 @@ namespace X10D.BooleanExtensions
|
|||||||
/// </example>
|
/// </example>
|
||||||
public static float ToSingle(this bool value)
|
public static float ToSingle(this bool value)
|
||||||
{
|
{
|
||||||
return value.ToByte();
|
return value ? 1.0f : 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user