Archives
-
Flattening a Jagged Array with LINQ
Today I had to flatten a jagged array. In my case, it was a string[][] and I needed to make sure every single string contained in that jagged array was set to something (non-null and non-empty). LINQ made the flattening very easy. In fact, I ended up making a generic version that I could use to flatten any type of jagged array (assuming it's a T[][]):