Top 10 reasons VB.NET is better than C#
http://www.vbrad.com/article.aspx?id=65
1. The amount of data casts and conversions in C# is gigantic. There are probably 10 casts per 50 lines of code. Most of the time these casts are totally unnecessary, like in this common example. I normally save the state of the form either to Ini file, Registry or XML file. So on application startup, I restore Form's state:
//get the form state from Ini File
//following line fails
FormWindowState eState = oIni.GetValue("FormState");
//must use cast (FormWindowState)
FormWindowState eState = (FormWindowState) oIni.GetValue("FormState");
//even this does not work
FormWindowState eState = 1;
//you have to use a cast even on simple numbers
FormWindowState eState = (FormWindowState) 1;
//finally set the value
this.WindowState = eState;So here we have a case where Form.WindowState should accept value such as 1, but refuses to. IMO, the compiler should be able to convert on the fly. I don't mind strong typing. I do mind stupid typing. In VB.NET all the lines below work.
me.WindowState = 1
me.WindowState = val(oIni.GetValue("FormState"))
没有评论:
发表评论