What is allowed in Visual Basic that's prohibited in C# (or vice versa)?

后端 未结 21 1883
渐次进展
渐次进展 2020-12-05 06:07

This is code-related as in what the compiler will allow you to do in one language, but not allow you to do in another language (e.g. optional parameters in

21条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-05 06:31

    In C# you have to assign your variable before you can use it. I think you can turn this off, but it's the default behavior.

    So something like this:

    int something;
    if (something == 10)
    { ... }
    

    Isn't allowed, but the VB equivalent would be.

提交回复
热议问题