c# - how to make a clean code for a multiple condition -
is there anyway make code shorter , easier read when there multiple condition in program
for example
i got 2 buttons, each of got own tag each of button's tag determine show on messagebox
for( int = 0 ; < 2 ; ++ ) { var mybutton = new button() { size = new size ( 10, 10 ), location = buttonslocation[i], tag = }; mybutton.mouseenter += buttonsmenter; this.controls.add(mybutton); } private void buttonmenter(object sender, eventargs e) { var mybutton = (button) sender; int = convert.toint32(mybutton.tag); if ( == 0 ) messagebox.show(" message "a" function"); else if ( == 0 ) messagebox.show(" message "b" function); }
it still easy read , code if few condition if condition lot let says has 10 condition have make 10 condition , long
is there anyway make code shorter, easier read, , easier code thank you..
Comments
Post a Comment