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.


Need Help with Your C# Projects?

We offer expert support and development services for projects of any size. Contact us for a free consultation and see how we can help you succeed.

CONTACT US NOW