기본 콘텐츠로 건너뛰기

10월, 2017의 게시물 표시

C# - 10 진수를 BitArray 로 변환

string str = textBox1.Text; int Dec = Convert.ToInt32(str, 16); string binary = Convert.ToString(Dec, 2);           textBox2.Text = binary; BitArray io_list = new BitArray(new int[] { Dec }); <== 10진수를 BitArray로 변환 byte Dec1 = Convert.ToByte(Dec);  <== 8 bit 부호 없는 int 형 BitArray io_list = new BitArray(new byte[] {Dec1}); if (io_list[0] == true)   panel1.BackColor = Color.Lime; else   panel1.BackColor = Color.LightSalmon;

C# - BitArray to Enum 1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 public enum States {      Alabama,      // ...      Wyoming }      BitArray baStatesIveVisited = new BitArray(50);      baStatesIveVisited[( int )States.Minnesota] = true ;      baStatesIveVisited[( int )States.Wisconsin] = true ;      baStatesIveVisited[( int )States.California] = true ;      States nextState = States.Alabama;      foreach ( bool b in baStatesIveVisited)          Console.WriteLine( "{0}:{1}" , nextState++, b);