public static T To <T>(U value) { T[] result = new T[1]; Buffer.BlockCopy(new U[] { value }, 0, result, 0, StreamUtils.GetSizeInBytes(typeof(U))); return(result[0]); }