Improve readability of long line of code with embedded quotation marks

I have a long list of values to write out to a csv file coming out of MS SQL. Just to make my code more readable and not have one long line of code, how can this line be written so it continues across multiple lines? The quotes within the command seem to confuse it.

tw.WriteLine("{0,1},{1,1},{2,1},{3,1},{4,1},{5,1},{6,1},{7,1},{8,1},{9,1},{10,1},{11,1},{12,1},{13,1},{14,1},{15,1},{16,1},{17,1},{18,1},{19,1},{20,1},{21,1},{22,1},{23,1},{24,1},{25,1}, {26,1},{27,1},{28,1},{29,1},{30,1},{31,1},{32,1},{33,1}", dr["Call"],dr["CallDate"],dr["TimeRcvd"],dr["HourRcvd"],dr["ESRI_LOCATION"],dr["INC_LOCATION"],dr["ZIP_Code"],dr["Full_Name"],
dr["RP_First_Name"],dr["RP_Last_Name"],dr["Phone"],dr["ADDRESS"],dr["City"],dr["CallCode"],dr["CallType"],dr["Zone"],dr["OffInitiated"],dr["Dispo"],dr["Units1st"],dr["UnitsAll"],
dr["DSP"],dr["Disposition"],dr["Cancel_Code"],dr["Cancel_Reason"],dr["InitiateCode"],dr["InitiationType"],dr["PSN"],dr["PSN_NAME"],dr["Split_From"],dr["Linked"],dr["REMARKS_X"],
dr["Agency"],dr["Dist"],dr["OFF_INIT"]);
LVL 1
rwheeler23Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

it_saigeDeveloperCommented:
If you are using C# 6/Visual Studio 2017, you could use an interpolated string.  If you are not using C# 6, you could just segregate the string template from the parameter list.  Or if you just want to print the row content, you could always just use String.Join.

Proof of concept:
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;

namespace EE_Q29070910
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create sample data
            var gradeLines = (from i in Enumerable.Range(0, 5) select 
                              (from g in Enumerable.Range(1, 20) select
                               new KeyValuePair<string, int>($"val_{g}", g + i * 10)).ToDictionary(k => k.Key, v => v.Value));

            // Create our datatable using the sample data
            var table = new DataTable("Grades");
            table.Columns.AddRange(gradeLines.First().Select(c => new DataColumn() { ColumnName = c.Key, DataType = typeof(int) }).ToArray());
            gradeLines.ToList().ForEach(r => table.Rows.Add(r.Select(c => c.Value).Cast<object>().ToArray()));

            PrintUsingInterpolatedStrings(table);
            Console.WriteLine();
            PrintUsingSegregatedStringTemplate(table);
            Console.WriteLine();
            PrintUsingStringJoin(table);

            Console.ReadLine();
        }

        static void PrintUsingInterpolatedStrings(DataTable table)
        {
            if (table != null)
            {
                Console.WriteLine("Printing using an interpolated string");
                foreach(var row in table.Rows.Cast<DataRow>())
                {
                    Console.WriteLine($"{row["val_1"],1},{row["val_2"],1},{row["val_3"],1},{row["val_4"],1},{row["val_5"],1}," +
                        $"{row["val_6"],1},{row["val_7"],1},{row["val_8"],1},{row["val_9"],1},{row["val_10"],1}," +
                        $"{row["val_11"],1},{ row["val_12"],1},{row["val_13"],1},{row["val_14"],1},{row["val_15"],1}," +
                        $"{row["val_16"],1},{row["val_17"],1},{row["val_18"],1},{row["val_19"],1},{row["val_20"],1}");
                }
            }
        }

        static void PrintUsingSegregatedStringTemplate(DataTable table)
        {
            if (table != null)
            {
                Console.WriteLine("Printing using a segregated string template");
                var template = "{0,1},{1,1},{2,1},{3,1},{4,1},{5,1},{6,1},{7,1},{8,1},{9,1},{10,1},{11,1},{12,1},{13,1},{14,1},{15,1},{16,1},{17,1},{18,1},{19,1}";
                foreach (var row in table.Rows.Cast<DataRow>())
                {
                    Console.WriteLine(template, row["val_1"], row["val_2"], row["val_3"], row["val_4"], row["val_5"], row["val_6"], row["val_7"], row["val_8"], row["val_9"],
                        row["val_10"], row["val_11"], row["val_12"], row["val_13"], row["val_14"], row["val_15"], row["val_16"], row["val_17"], row["val_18"], row["val_19"], row["val_20"]);
                }
            }
        }

        static void PrintUsingStringJoin(DataTable table)
        {
            if (table != null)
            {
                Console.WriteLine("Printing using string.Join");
                foreach (var row in table.Rows.Cast<DataRow>())
                {
                    Console.WriteLine("{0}", string.Join(",", row.ItemArray.Select(x => string.Format("{0,1}", x.ToString()))));
                }
            }
        }
    }
}

Open in new window

Produces the following output -Capture.PNG

-saige-
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rwheeler23Author Commented:
This is excellent. Thank you.
0
rwheeler23Author Commented:
This is excellent. Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.