0

I was in a situation wherein I had to regex-parse some C# code for a little task, and was tripped-up by something which I would have assumed was C# syntax error:

var moop = new { Moop = "Hello", };

This compiles correctly.

My question - What purpose does allowing a trailing comma / empty term serve?

It's valid in arrays, too:

var arr = new[]{1,2,3,};
Dave Bish
  • 19,263
  • 7
  • 46
  • 63

0 Answers0