Reputation: 144
var zip = testNames.Zip(testNumbers, (code, state) => code + ": " + state);
returns an IEnumerable
of strings, how would I get IEnumerable
string string?
Upvotes: 0
Views: 149
Reputation: 117029
Here are you two choices, based on what you've given us in your question:
var testNames = new [] { "A", "B" };
var testNumbers = new [] { 1, 2 };
var zip1 = testNames.Zip(testNumbers, (code, state) => new { code, state });
var zip2 = testNames.Zip(testNumbers, (code, state) => (code, state));
Both are valid C#.
Based on reading your previous question you should need to get in to this .Zip
scenario. You should be able to read your original data in a single query. My answer shows you how.
Upvotes: 2