public static ReceivedData SplitContent(string lineOfText) { var splitBySemiColon = lineOfText.Split(';'); if (splitBySemiColon.Length < 2) { return(null); } var receivedData = new ReceivedData(); foreach (var stringFragment in splitBySemiColon) { var splitByEquals = stringFragment.Split('='); if (splitByEquals.Length > 1) { var dataAsString = splitByEquals[1]; switch (splitByEquals[0]) { case "Probabillity": receivedData.AddProbabillity(dataAsString); break; case "Rotation": receivedData.AddRotation(dataAsString); break; case "FileChangedDate": receivedData.AddFileChangedDate(dataAsString); break; default: break; } } } return(receivedData); }