Switch is different from java in. NET .,. Netswitch
1. It cannot run like this
We know that java and C can do this when using the switch.
Switch (I)
{
// Break is not used here in java
// The statement corresponding to case 1 is executed and directly runs through the statement in case 2.
Case 1:
Console. WriteLine ("111 ");
Case 2:
Console. WriteLine ("222 ");
Break;
Default:
Console. WriteLine ("333 ");
Break;
}
But in C #, an error is returned.
In C #, each case with a statement must have a break.
Like this
2. Does it mean that case in C # cannot run through? No!
When there is no code in a case statement, it can still run through.
This is what I want to talk about. Different languages are always slightly different. However, they are ideologically consistent.
Each language has its own way of expression.
These are not the same...
Just like any language in the world, you can sing the most beautiful songs.
In the programming world, there is no spam language, but the use of people is uneven.
Reference page:
Http://www.yuanjiaocheng.net/mvc/mvc-views.html
Http://www.yuanjiaocheng.net/Hibernate/first.html
Http://www.yuanjiaocheng.net/webapi/web-api-host.html
Http://www.yuanjiaocheng.net/ASPNET-CORE/core-actionresults.html
Http://www.yuanjiaocheng.net/CSharp/csharp-extension-method.html
Http://www.yuanjiaocheng.net/ASPNET-CORE/core-identity-migrations.html
Http://www.yuanjiaocheng.net/ASPNET-CORE/core-setup-entityframework.html
Http://www.yuanjiaocheng.net/mvc/bundling-and-minification-in-asp.net-mvc.html
Http://www.yuanjiaocheng.net/mvc/mvc-razor-yufa.html
Http://www.yuanjiaocheng.net/mvc/mvc-helper-TextArea.html
Http://www.yuanjiaocheng.net/mvc/mvc-helper-textbox.html