Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>OK, first off I moved the calculation logic into a method to make this a bit clearer, so you'll need to add this:</p> <pre><code>private double GetTheAnswer(double first, double second) { double answer = (first - second) / second; return answer; } </code></pre> <p>Then I modified your LINQ statement and selected the bits you're interested in into an anonymous object. After that I added 1 more field on the end of your output write statement and then accessed the properties that I defined against the anonymous type. Also I removed the array index '[x]' against item:</p> <pre><code> using (var sw = new StreamWriter("testNetOil.csv")) { var items = netOil.Zip(seqNum, (oil, seq) =&gt; new { Oil = oil, Seq = seq }); var items2 = netOil2.Zip(seqNum2, (oil, seq) =&gt; new { Oil = oil, Seq = seq }); sw.WriteLine("Lease Name, Field Name, Reservoir, Operator, County, ST, Majo, Resv Cat, Discount Rate, Net Oil Interest, Net Gas Interest, Working Interest, Gross Wells, Ultimate Oil, Ultimate Gas, Gross Oil, Gross NGL, Gross Gas, Net Oil, Net Gas, Net NGL, Revenue To Int., Oper. Expense, Total Invest., Revenue Oil, Revenue Gas, Operating Profit, Revenue NGL, Disc Net Income, SEQ, Well ID, INC ASN, Life Years, Own Qual, Production Tax, NET OIL VARIANCE"); foreach (var item in items.Join(items2, i =&gt; i.Seq, i =&gt; i.Seq, (a, b) =&gt; new { SeqID = a.Seq, Answer = this.GetTheAnswer(Convert.ToDouble(a.Oil), Convert.ToDouble(b.Oil)) })) { int x = listHead; while (x != -1) { sw.WriteLine("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, {25}, {26}, {27}, {28}, {29}, {30}, {31}, {32}, {33}, {34}, {35}, {36}", QuoteString(leaseName[x]), fieldName[x], QuoteString2(reservoir[x]), operator1[x], county[x], state[x], majo[x], resvCatgory[x], disRate[x], netOil2Int[x], netGas2Int[x], workingInt[x], grossWells[x] , ultOil[x], ultGas[x], grossOil[x], grossNGL[x], grossGas[x], netOil[x], netGas[x], netNGL[x], revToInt[x], operExpense[x], totInvest[x], revOil[x], revGas[x], operatingProfit[x], revNGL[x], discNetIncome[x], seqNum[x], wellID[x], incASN[x], lifeYears[x], ownQual[x], prodTax[x], item.SeqID, item.Answer); x = pointers[x]; //sw.WriteLine(item); } sw.Close(); } } </code></pre> <p>Obviously I couldn't test this for you but hopefully this will send you down the right path and I got the right end of the stick!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload