public static BillState GetBillState(string stateTypeName) { var list = FindAllDerivedStates(typeof(BillState)); dynamic returnedValue = new UnsettledBill(); foreach (var state in list) { if (state.Name == stateTypeName) { returnedValue = (BillState)Activator.CreateInstance(state); } } return(returnedValue); }
protected Bill(double amount) { Amount = amount; State = new UnsettledBill(this); OrderedDate = DateTime.Now; }