Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

best way to compare four or more strings

$
0
0

Is there any shorter/simpler way to do this?

if (Button1.Text == Button2.Text || Button1.Text == Button3.Text || Button1.Text == Button4.Text ||
                Button2.Text == Button3.Text || Button2.Text == Button4.Text || Button3.Text == Button4.Text){
//do something
}

maybe LINQ or something.

Thanks in advance


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>