Converting sbyte to byte

bit, byte, c#

Solution

unchecked
{
    sbyte s;
    s= (sbyte)"your value";
    byte b=(byte)s;
}

More about `unchecked` is here

Problem

I have a variable of type `sbyte` and would like to copy the content to a `byte`. The conversion wouldn't be a value conversion, rather a bit per bit copy. For example, if mySbyte in bits is: '10101100', after conversion, the corresponding byte variable will also contain the bits '10101100'.

Original source