Introduction to the second Internet: s.Generic.Stack (statement source code) did not score the Stack class thought of as the process has the following schematic: Stack class indicative source: public class stack <> {T [] item; int count ; public void Push (T item) {} public T pop () {}} No results for the generic type parameter set three kinds of constraints: the derived constraints, structural parameter constraints, the reference / value type constraint Anonymous Tip: Almost Anonymous Tips ... Body:
Generic:
Generic Description: Generic class can actually be used, tricks, frameworks, interfaces, delegates and other design, and reusability, type and high efficiency is associated in a non-generic of the reach for the practical application of generic , required application class System.Collections.Generic.Stack. Such a statement as follows:
System.Collections.Generic.Stack (Declaration)
No results the Stack class thought of as the process has the following schematic:
Indicative of the source code of class Stack:
public class stack <>
{
T [] item;
int count;
public void Push (T item) {}
public T pop () {}
}
No results for the generic type parameter to set the constraints 3: derived constraints, structural parameter constraints, the reference / value type constraint
Anonymous tips:
Anonymous tips overview: In C # 1.x, the application support calls tricks of the delegate to occur event. Fu and tricks to help calculate commission to add or delete the purpose of tips, did not result in the whole. Net framework, widely used for events, callbacks, asynchronous calls, multithreading. However, in order to apply a commission, and sometimes can not not create a class or a trick, this approach is too cumbersome, and the habit of thinking with the DEV we do not match. For example, the following example arose from a box containing a list, document boxes, and buttons for simple input form. When you press the button, the document box of the document will be added to the list box. In C # 1.x, the application event mechanism entrusted to occur, the source code looks like
The emergence of application C # 1.x source code
class InputForm: From
{
ListBox listBox;
TextBox textBox;
Button addButton;
pulic MyForm ()
{
listBox = new ListBox ();
textBox = new TextBox ();
addButton = new Button ();
}
........
void AddClick (object sender, EventArgs e)
{
listBox.Items.Add (textBox.Text)
}
}
Anonymous tips allow one associated with the source code (usually tips entity) "embedded" into the application areas delegate, delegate and tricks entities that together
The emergence of anonymous tips application source code (no argument)
class InputForm: From
{
ListBox listBox;
TextBox textBox;
Button addButton;
pulic MyForm ()
{
listBox = new ListBox ();
textBox = new TextBox ();
addButton = new Button ();
addButton.Click + = delegate {listBox.Items.Add (textBox.Text);}
}
}
No comments:
Post a Comment