public Account CreateAccount(string str) { var profile = str.Split (','); Account acc; switch (profile [3]) { case "Saving": acc = new SavingAccount (profile [2], Convert.ToDouble (profile [4]), profile [0], profile [1]); break; case "Current": acc = new CurrentAccount (profile [2], Convert.ToDouble (profile [4]), profile [0], profile [1]); break; default: acc = null; break; } return acc; }
public Account CreateAccount(string str) { var profile = str.Split(','); Account acc; switch (profile [3]) { case "Saving": acc = new SavingAccount(profile [2], Convert.ToDouble(profile [4]), profile [0], profile [1]); break; case "Current": acc = new CurrentAccount(profile [2], Convert.ToDouble(profile [4]), profile [0], profile [1]); break; default: acc = null; break; } return(acc); }