You can use events to define some external interfaces for your type. The event is based on a delegate because the delegate can provide type-safe function signatures to the event handle. Plus most of the delegates ' examples are illustrated with
A cursory look, the feeling that implementation interface and virtual function overload is the same. You define objects, but these objects are stated in another type. You are deceived by the first feeling, implementation interface and virtual
Our goal: to write the C # code as efficiently, more robust, and easier to maintain as possible.
Principle One: Use attributes (property) as much as possible, rather than data members (field).
Always use properties instead of the accessible data
1. Create a C # Windows application
2. Add a Windows Form label to Form1.cs
3. Click the Label1 control and change the Text property to a null character
4. Change the BorderStyle property to FixedSingle
5. Right-click Form1.cs, then click View
This code is a transformation, not too deep technical difficulty, just exclude the original code errors, add some general requirements. Currently, this class can implement the following functions:
1. The basic function of pinyin conversion to
1. MouseClick event occurs when the mouse clicks the control. Syntax: public event EventHandler MouseClick
EventHandler: Represents a method that will handle events that do not contain event data.
Example MouseClick use of events
Click anywhere
Ref is the address of the pass parameter, out is the return value, the two have some similarities, but there are different points.
You must assign a value to a variable before you use Ref.
The Out function empties the variable, even if the
Intention
Defines a one-to-many dependency between objects, and when the state of an object changes, all objects that depend on it are notified and automatically updated.
Scene
Let's not talk about the game this time, suppose we need to page
Intention
Encapsulates a request into an object so that you can parameterize the client with different requests, queue or log request logs for requests, and support actions that can be undone.
Scene
We know that the client in the network game
Intention
Enables multiple objects to have the opportunity to process the request, thus avoiding the coupling between the sender and the recipient of the request. Connect the objects into a chain and pass the request along this chain until an
Intention
Separate the abstract parts from the implementation parts so that they can be changed independently.
Scene
Or we have to do the network game, multiple scenarios need to expand the problem we have adopted the creation of the model to
This article gives a C # programming to achieve read-write Binary example code, for beginners is a rare reference article ...
The following is a reference fragment:
//Return BLOB data public MemoryStream GetBlob (string SQL) ... { Try ... { Db_
What is generics
A type placeholder, or called a type parameter. We know that in a method, the value of a variable can be used as a parameter, but the type of the variable itself can also be used as a parameter. Generics allow us to specify what
Intention
Provides a proxy for other objects to control access to this object.
Scene
Agent mode is very common, the idea is to reduce the use complexity of objects by adding an agent to the object, or to promote the friendliness of objects, or to
Principle: (Here is a demonstration of the invariant form movement), two timer, one control from left to right, to the pre-set point to trigger another timer,
Of course, another timer controls movement from right to left (its essence is the change
Principle: N ListView controls, N button controls, and then controls the Dock property of the ListView and button controls
As follows:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using
Database access is the most common part of a program. With the introduction of C # and Ado.net, this operation becomes simpler. This article will demonstrate four of the most basic database operations.
Read the data. This includes a variety of data
Train of thought: To do a network phone, basically follow the following steps
1, one side real-time recording, converts the analog signal into the digital signal;
2, the sound real-time compression;
3, through the network protocol to the
The running interface is as follows:
Two notes:
Implementation of this function in C + + is very simple, there are many classic examples can be achieved, in C # There are many problems will occur.
For the hook is not familiar with the knowledge
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service