I am writing a statement and it compiles, but the compiler [VS] never tells me that I put the semicolon two times.
This means in ASP.NET MVC 3
return Json(mydata);;
return Json(mydata);
Both of them compile, but the first is wrong in design pattern. Why doesn’t it tell me about the two semicolons?
If there is no reason to use two semicolons, why doesn’t it show an error?
If there is a special use of it, please show me where two semicolons is required to write a statement in C#.
No, a double semi-colon is never required. I’m slightly surprised that the compiler doesn’t complain that it’s an unreachable statement, but apparently it’s legal. It won’t do any harm, but equally it’s not a good idea.