Team,
I have two fields in a record that are tilde delimited and have the same number of items (between 1 and 5 items). One field in the row would be A~B~C~D~E and the other field would be V~W~X~Y~Z. I would like a List with two strings of these values like:
A V
B W
C X
D Y
E Z
have you tried something with a simple c# split command?
string myString = "A~B~C~D~E";
List<string> myList = myString.Split('~').ToList();
I was hoping I could make one simple lists instead of two arrays. This code works, but seems less “elegant”…
var repData = Db.OrderHed.Where(O => O.Company == tt.Company && O.OrderNum == tt.OrderNum).Select(O => new {O.SalesRepList,O.ShortChar02}).First();
string[] repID = repData.SalesRepList.Split('~');
string[] repSource = repData.ShortChar02.Split('~');
If I understand what you want correctly I think the Enumerable.Zip Method can do what you want.
int[] numbers = { 1, 2, 3, 4 };
string[] words = { "one", "two", "three" };
var numbersAndWords = numbers.Zip(words, (first, second) => first + " " + second);
foreach (var item in numbersAndWords)
Console.WriteLine(item);
// This code produces the following output:
// 1 one
// 2 two
// 3 three
I was about to recommend exploring .Zip and there it is
^
Wondering why I’ve never seen that function. Neat
I think you gave this book to Julie 
