1. If you might try to use the interface to program the .NET framework includes classes and interfaces, when writing programs, you may know which class is using .NET. However, in this case if you use the .NET supported interface instead of its class to program, the code will be more stable, usability will be higher. Please analyze the following code: This function is loaded from one of the arrays that can be any object, which is limited to only an array. Imagine that you find those objects in the database, or other collections. Then you need to modify the program to use different collection types. If you use the iCollection interface to write that program, you don't have to modify the program, which can work well for any type of ICollection interface: iCollection is an array and all the collection of all system.collection. In addition, the multidimensional array also supports the iCollection interface. If it is not enough, the database .NET class also supports the iCollection interface. This function written with the interface does not need to be changed, can be used in many cases. 2. Use the property instead of the original data because the attribute has become the element of the language itself, so its scope level is not necessary to greater than private. Because the code itself looks at the property as a data element, you don't lose the convenience of using the simple data type. On the contrary, it will make your code more flexible and more powerful. The property makes your data element packaging better. Properties allow you to use Lazy Evaluation to return data. Lazy Evaluation means calculating its value when the user requests, not always keeping it. Finally, the attribute can be Virtual or Abstract. You can also define properties in the interface. There is also a maintenance factor should note: Although the method of operation is the same, you turn a data element into an attribute, then the original client's program cannot access the new version of the server. In fact, for the value you want to implement in Web Service, you can use them into properties:
Private int called = 0; [XMlattribute ("Month")] public int month {get {return themonth;} set {THEMONTH = value;}} Simple through properties allows you to privatize all of your data elements. 3. Using DLEGATE in Producter / Consumer's IDiom When you generate a Producer IDiom class, use Deletate to notify CONSUMER. This method is more flexible relative to the interface. Delegate is multi-point transmission, so you don't have to add an additional code you will support multi-user. The coupling between the classes can be lowered relative to the interface. The following class handles the keyboard input and pass it to all Registered Listeners: