Does anyone know if it's possible to loop through the parameters of a function and return the object type and in the instance of say int and string the object value? Code: xlSheet.Row CreateContentRow(int index, string user, string limit, string card) { string[] headerColumns = new string[] { "A", "B", "C" }; //Create the new row. xlSheet.Row r = new xlSheet.Row(); r.RowIndex = (UInt32)index; [B]xlSheet.Cell firstCell = CreateTextCell(headerColumns[0], user, index); xlSheet.Cell secondCell = CreateTextCell(headerColumns[1], limit, index); xlSheet.Cell thirdCell = CreateTextCell(headerColumns[2], card, index); r.AppendChild(firstCell); r.AppendChild(secondCell); r.AppendChild(thirdCell);[/B] return r; } FunctionObjects(CreateContentRow) { foreach(object obj in CreateContentRow.Objects) { if(obj.type == string) { string test = obj.value; } } } Was just wondering whether it was possible to compress the 6 bold lines into 2?
Thanks. Code: xlSheet.Row CreateContentRow(int index, string user, string limit, string card) { string[,] headerColumns = new string[,] { { "A", "B", "C" }, { user, limit, card } }; //Create the new row. xlSheet.Row r = new xlSheet.Row(); r.RowIndex = (UInt32)index; //Loop to add each element to a cell for (int i = 0; i <= 2; i++) { xlSheet.Cell inputCell = CreateTextCell(headerColumns[0, i], headerColumns[1, i], index); r.AppendChild(inputCell); } return r; }