design-patterns

Replace switch statement

有些话、适合烂在心里 提交于 2020-11-30 02:06:02
问题 I have to calculate the price based on multiple input variables public class Model { public int Account { get; set; } public long Related{ get; set; } public int TransactionType { get; set; } public string detail{ get; set; } public int PlanId { get; set; } } First switch starts with TransactionType . Based on TransactionType I need to use Account,PlanId ,Related fields for more information from database to get more information and some configurable information. There are more conditions

What is the difference between design patterns and libraries?

蓝咒 提交于 2020-11-29 23:22:47
问题 What is the difference between design patterns and libraries? I cannot seem to find the difference anywhere. 回答1: DesingPatterns are considered to assist the developer by solveing already known problems. For instance, the ObserverPattern is used to observe a concreate object and carry out specific actions, the mediator is used to center the application logic and handle dependencies on a object, the composite is used to model a tree structure, etc. In general DesignPatterns can be categorized