Quantcast
Channel: Tópicos
Viewing all articles
Browse latest Browse all 11336

converter Int em array bool

$
0
0
Não percebi bem o que pretendes. Tens um int com tipo 110101100 e queres converter para um array de bool é isso? Pode haver maneiras mais elaboradas, mas podes sempre converter num array de char e verificares char a char. Exemplo int x = 110101001; char[] t = x.ToString().ToCharArray(); bool[] a; a = new bool[t.Count()]; for(int y = 0; y < t.Count(); y++) { if (int.Parse(t[y].ToString()) == 1) a[y] = true; }

Viewing all articles
Browse latest Browse all 11336

Trending Articles