If you want to keep your OrderID1, OrderID2... variables:

string[] pipedListItems = stringListItems.Split(Convert.ToChar("|"));

int OrderID1 = pipedListItems.Length > 0 ? Convert.ToInt32(pipedListItems[0]) : 0;

int OrderID2 = pipedListItems.Length > 1 ? Convert.ToInt32(pipedListItems[1]) : 0;

int OrderID3 = pipedListItems.Length > 2 ? Convert.ToInt32(pipedListItems[2]) : 0;

int OrderID4 = pipedListItems.Length > 3 ? Convert.ToInt32(pipedListItems[3]) : 0;

int OrderID5 = pipedListItems.Length > 4 ? Convert.ToInt32(pipedListItems[4]) : 0;

Or another solution using an array:

string[] pipedListItems = stringListItems.Split(Convert.ToChar("|"));

int[] OrderIDs = new int[5];

for (int i = 0; i < pipedListItems.Length; i++)

OrderIDs[i] = Convert.ToInt32(pipedListItems[i]);

//int OrderID1 = OrderIDs[0];

//int OrderID2 = OrderIDs[1];

//int OrderID3 = OrderIDs[2];

//int OrderID4 = OrderIDs[3];

//int OrderID5 = OrderIDs[4];

string[] pipedListItems = stringListItems.Split(Conv

int OrderID1 = pipedListItems.Length > 0 ? Convert.ToInt32(pipedListI

int OrderID2 = pipedListItems.Length > 1 ? Convert.ToInt32(pipedListI

int OrderID3 = pipedListItems.Length > 2 ? Convert.ToInt32(pipedListI

int OrderID4 = pipedListItems.Length > 3 ? Convert.ToInt32(pipedListI

int OrderID5 = pipedListItems.Length > 4 ? Convert.ToInt32(pipedListI

Or another solution using an array:

string[] pipedListItems = stringListItems.Split(Conv

int[] OrderIDs = new int[5];

for (int i = 0; i < pipedListItems.Length; i++)

OrderIDs[i] = Convert.ToInt32(pipedListI

//int OrderID1 = OrderIDs[0];

//int OrderID2 = OrderIDs[1];

//int OrderID3 = OrderIDs[2];

//int OrderID4 = OrderIDs[3];

//int OrderID5 = OrderIDs[4];