Declaring and setting multiple variables of the same type in the same statement in C#

Does anyone actually use this variation of declaring variables?

I rarely see it.

I think its possibly useful in instances where the variables are highly related (eg.. x, y or startDate, endDate). This way the reader can know they belong together but I wouldn’t be bunching a load of variables up just because they are all public strings etc.

Leave a Reply

Your email address will not be published.