Simple syntactic c# question is this.
Given this code:
List<string> Columns = new List<string>();
List<string> Parameters = new List<string>();
List<string> Values = new List<string>();
It can be reduced to:
List<string> Columns = new List<string>(), Parameters = new List<string>(), Values = new List<string>();
But can I get it shorter still, since they’re all being initialised to an empty list?
Thank you all!
I can recommend to use
varkeyword if these variables are not class fields, because types are know from usage. It really makes no sense to flat declaration of three variables.Yes, you can do things, like declaring multiple local variables in one line and then initializing them in one line. But please, avoid declaring multiple variables in one line – it makes code much readable.