vb.net - Refactoring case select into if statement -
i have following code:
dim usefont font = e.font dim mybrush brush = brushes.black ' determine font draw each item based on ' index of item draw. if e.index = 0 or 7 or 10 or 13 usefont = new font(e.font, fontstyle.bold) else usefont = defaultfont end if ' select e.index ' case 0 'usefont = new font(e.font, fontstyle.bold) ' case 7 'usefont = new font(e.font, fontstyle.bold) ' case 10 'usefont = new font(e.font, fontstyle.bold) ' case 13 'usefont = new font(e.font, fontstyle.bold) 'end select
the commented out code below old, working code. thought better rewrite make more compact , readable, cannot work out how perform same function case select, results in list items becoming bold. don't know if i'm misunderstanding or operator, , orelse not work either.
can give me pointers in right direction? thanks.
if e.index = 0 or e.index= 7 or e.index=10 or e.index=13
but equally have done
case 0,7,10,13
Comments
Post a Comment