Declare and assign multiple string variables at the same time

前端 未结 10 2276
醉话见心
醉话见心 2020-12-08 13:03

I\'m declaring some strings that are empty, so it won\'t throw errors later on.

I\'ve read that this was the proper way:

string Camnr = Klantnr = Ord         


        
10条回答
  •  旧巷少年郎
    2020-12-08 13:27

    Just a reminder: Implicit type var in multiple declaration is not allowed. There might be the following compilation errors.

    var Foo = 0, Bar = 0;
    

    Implicitly-typed variables cannot have multiple declarators

    Similarly,

    var Foo, Bar;
    

    Implicitly-typed variables must be initialized

提交回复
热议问题