foreach (string sn in MACOrSerial.Split(','))
{
MACOrSerial = sn.Trim();
}
MACORSerial contains a string of text (EX. AA123241, BB123431, CC1231243) separated by commas. I grab one substring and place that into the same MACORSerial.
This will not cause me any problems as the the foreach still will be using the original MACOrSerial in memory.
While I think this is the most memory efficient approach, is it proper or should I just make another string with a new name such as
MacORSerialSubString = sn.Trim()?
I am not having any memory issues. I just want to make sure my code is clean and concise.