Note that there are some explanatory texts on larger screens.

plurals
  1. POCombine anonymous columns to form new collection
    primarykey
    data
    text
    <p>I’ve been reviewing many, many postings/responses here but haven’t found (or perhaps understood is better description) a solution. I’m trying to develop a linq statement(s) so that I can parse collections of data. </p> <p>I have an anonymous collection of data where I need to be able to specify two unrelated columns and combine their values to form a new collection of their combined value. The collection is read into an IEnumerable> (and the result needs to the same).</p> <p>Depending upon the data sample, the columns to be combined will vary. In scenario A (see data sample #1) columns 1 &amp; 3 are needing to be combined to generate a result set (see result #1). In scenario B (see data sample #2) columns 2 &amp; 4 are needing to be combined to generate a result set (see result #2). Column headings (first row) aren’t known ahead of time, and all values are strings (empty string and non-null).</p> <p>What I would love to see something along the lines of the following:</p> <pre><code>int ColyY = 1; int ColyX = 3; var result = FetchMergedColumn(ColX, ColY); </code></pre> <p><strong>Data sample #1:</strong></p> <pre><code>Col1 Col2 Col3 Col4 Fish Blue Cloudy 10 Dog Red Rain 33 Cat Black Thunder 55 </code></pre> <p><strong>Result #1:</strong></p> <pre><code>Fish Cloudy Dog Rain Cat Thunder </code></pre> <p><strong>Data sample #2:</strong></p> <pre><code>Col1 Col2 Col3 Col4 Blue Fish 10 Cloudy Red Dog 33 Rain Black Cat 55 Thunder </code></pre> <p><strong>Result #2:</strong></p> <pre><code>Fish Cloudy Dog Rain Cat Thunder </code></pre> <p>Can anyone help me out?</p>
    singulars
    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.
 

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