C# Writing multiple records to one line
<p>I am using c# to write create a text file. I am attempting to write 2 records on one line in a text file. My data source is from a result set from a stored procedure. </p>

<p>Here is the code that I have. At the moment I am only writing record by record. I would like to write 2 records on one line into a text file. </p>

<p>example: </p>

<p>record 1   record 6</p>

<p>record 2   record 7</p>

<p>record 3   record 8</p>

<p>record 4   record 9</p>

<p>record 5   record 10</p>

<p>record 11   record 16</p>

<p>record 12   record 17</p>

<p>record 13   record 18</p>

<p>record 14   record 19</p>

<p>record 15   record 20</p>

<pre><code>    public bool SalesPriceIndexProcess()
    {
        int page = 1, count = 1;
        FileStream fs = new FileStream(Properties.Settings.Default.Path + SalesPriceDirectoryReportName, FileMode.Create);
        StreamWriter sw = new StreamWriter(fs);
        foreach (ManhattanLUSESalesPriceIndex_Result s in _db.ManhattanLUSESalesPriceIndex())
        {
            if (count == 1)
            {
                SalesPriceHeaderWrite(s.BldgClassCd, ref fs, ref sw);
            }
            string saleDate = s.SaleDt.ToString();
            sw.WriteLine("{0,13:C0}{1,-5} {2,-4} {3,5} {4,3} {5,15:C0}{6} {7,-8} {8,4}"
                , s.SalePriceAmt, s.MultiSplitCd
                , Convert.ToInt16(s.StoriesNbr) + s.LandUseMajorCd
                , (s.LegalBlkId + "-"), s.LegalLot
                , s.TransAssdTotalAmt, s.BldgClassCd.PadRight(2)
                , (saleDate.Length &gt; 6 ? saleDate.Substring(4, 2) + "/" + saleDate.Substring(6, 2) + "/" + saleDate.Substring(2, 2) : "")
                , page    
                );

            PclIdPageIndexDict.Add(s.PclId, page);
            if (count % 5 == 0)
            {
                sw.WriteLine(SalesPriceLineBreak);
            }
            if (count % 145 == 0)
            {
                sw.WriteLine(SalesPricePageBreak);
            }

            count++; //increment by 1
            page = count % 145;
        }
        return true;
</code></pre>
