mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-10 03:45:41 +00:00
Use explicit narrowing conversion
This commit is contained in:
parent
9e193e7142
commit
6e0255f6cf
@ -27,7 +27,7 @@ namespace X10D.BooleanExtensions
|
|||||||
[CLSCompliant(false)]
|
[CLSCompliant(false)]
|
||||||
public static sbyte ToSByte(this bool value)
|
public static sbyte ToSByte(this bool value)
|
||||||
{
|
{
|
||||||
return value ? 1 : 0;
|
return (sbyte)(value ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -53,7 +53,7 @@ namespace X10D.BooleanExtensions
|
|||||||
[CLSCompliant(false)]
|
[CLSCompliant(false)]
|
||||||
public static ushort ToUInt16(this bool value)
|
public static ushort ToUInt16(this bool value)
|
||||||
{
|
{
|
||||||
return value ? 1 : 0;
|
return (ushort)(value ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -59,7 +59,7 @@ namespace X10D.BooleanExtensions
|
|||||||
/// <seealso cref="ByteExtensions.ByteExtensions.ToBoolean(byte)" />
|
/// <seealso cref="ByteExtensions.ByteExtensions.ToBoolean(byte)" />
|
||||||
public static byte ToByte(this bool value)
|
public static byte ToByte(this bool value)
|
||||||
{
|
{
|
||||||
return value ? 1 : 0;
|
return (byte)(value ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -135,7 +135,7 @@ namespace X10D.BooleanExtensions
|
|||||||
/// <seealso cref="Int16Extensions.Int16Extensions.ToBoolean(short)" />
|
/// <seealso cref="Int16Extensions.Int16Extensions.ToBoolean(short)" />
|
||||||
public static short ToInt16(this bool value)
|
public static short ToInt16(this bool value)
|
||||||
{
|
{
|
||||||
return value ? 1 : 0;
|
return (short)(value ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user