c# - How can I make each array, within an array perform a task? -
i getting data 1 of following names, adam, bob, cam, dan, earl, or fred. i want pairs operate on each other. right have string: string list="adam-bob;cam-dan;earl-fred"; then split them via semicolon string[] splitlist=list.split(';'); now have array of pairs so adam-bob cam-dan earl-fred [0] [1] [2] ideally, perform operation on each of them, instead find can following: split via ',' foreach (string s in splitlist) { string firstperson=splitlist[0]; string secondperson=splitlilst[1]; if (udpoutputdata.contains(firstperson)==true) { //record data string firstperson } if (udpoutputdata.contains(seoncdperson)==true) { //record data string secondperson } //if have data firstperson , secondperson, perform operation , give me output } unfortunately, if name adam, followed cam, operations disorganized. perhaps need automatically create string each name? or there eloquent way of operating data on first array... you array