Given a collection, I need to iterate through all the elements three (or some other amount) at a time. For example:
string[] exampleData = {"John", "Doe", "1.1.1990", "Jane", "Roe", "2.2.1980"}
for(int i = 0; i < exampleData.Length; i += 3) {
CreateUser(foreName: exampleData[i], surName: exampleData[i+1], dateOfBirth: exampleData[i+2]);
}
How could I efficiently reproduce this if exampleData was an IEnumerable instead of an array?