Use explicit narrowing conversion

This commit is contained in:
Oliver Booth 2021-04-02 12:11:01 +01:00
parent 9e193e7142
commit 6e0255f6cf
2 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,7 @@ namespace X10D.BooleanExtensions
[CLSCompliant(false)]
public static sbyte ToSByte(this bool value)
{
return value ? 1 : 0;
return (sbyte)(value ? 1 : 0);
}
/// <summary>
@ -53,7 +53,7 @@ namespace X10D.BooleanExtensions
[CLSCompliant(false)]
public static ushort ToUInt16(this bool value)
{
return value ? 1 : 0;
return (ushort)(value ? 1 : 0);
}
/// <summary>

View File

@ -59,7 +59,7 @@ namespace X10D.BooleanExtensions
/// <seealso cref="ByteExtensions.ByteExtensions.ToBoolean(byte)" />
public static byte ToByte(this bool value)
{
return value ? 1 : 0;
return (byte)(value ? 1 : 0);
}
/// <summary>
@ -135,7 +135,7 @@ namespace X10D.BooleanExtensions
/// <seealso cref="Int16Extensions.Int16Extensions.ToBoolean(short)" />
public static short ToInt16(this bool value)
{
return value ? 1 : 0;
return (short)(value ? 1 : 0);
}
/// <summary>