0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

C# bool の配列

Last updated at Posted at 2022-06-16

bool の配列を作り、それらがすべて true かどうかを1行で判定する方法

Form1.cs
int i = 100;
bool[] bools = new bool[3];
bools[0] = i > 50;
bools[1] = i < 200;
bools[2] = i * 2 == 300;
bool b = bools.All(result => result == true);

if(b == true) MessageBox.Show("OK");
else MessageBox.Show("NOT");

出力結果:NOT

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?