Search code examples
c#console-applicationline-breaks

How can I separate these two lists after Console.WriteLine?


I'm guessing this is something simple that I am overlooking but I have two lists that write to the console after sorting. How can I put one or 2 line breaks between the two lists to separate their output.

foreach (var number in map.OrderBy(i => i.Key))
{
    Console.WriteLine(number);
}

foreach (var color in map.OrderBy(c => c.Value == ColorType.White ?
                            0 : c.Value == ColorType.Yellow ? 1 : 2))
{
    Console.WriteLine(color);
}

Console.ReadLine();

With this both lists are together after the Console.Readline();

Here is what the results look like now.

[92, Yellow]
[94, Yellow]
[97, Red]
[98, White]
[99, Red]
[100, White]
[100, White]
[43, White]
[14, White]
[59, White]
[8, White]

This is what I'd like it to look like:

[92, Yellow]
[94, Yellow]
[97, Red]
[98, White]
[99, Red]

[100, White]
[100, White]
[43, White]
[14, White]
[59, White]
[8, White]

Any ideas?


Solution

  • You could just call

    Console.WriteLine();
    

    before the second foreach.