Contents that posted a long time ago may be obsolete and may not reflect my current opinion.

进制转换:

bin = Convert.ToString(dec, 2);

缺位补零:

bin = bin.PadLeft(8, '0');