VAR Universal variable:
var a = value/constructor instantiation;
Given what type of data it is, it automatically becomes the appropriate type and does not require a type conversion.
-----------------------------------------------------------------------------
Class Library:
1. A. cs source code file, sent over,
Add in your own project, reference namespaces, invoke methods;
Generally used within the company, because the source code files can be seen, and can be modified;
(This is not a class library)
Namespace consoleapplication1{ class Suanshu {//<summary>//// </summary >// <param name= "A" > First number </param>// <param name= "B" > Second number </param>// < returns></returns> public int Jiafa (int a, int b) { return a + b; } public int Jianfa (int a, int b) {return a-a ; } }
Namespace Class Library { class program { static void Main (string[] args) { var a = ten; var B = 20;
Console.WriteLine (c);
}
2. Class Library Mode:
A class library, is a DLL at the end of the file, is the source code after the compilation of auxiliary files;----This file can be referenced, cannot read the modified
After you add a reference to your project, reference the corresponding namespace,
You can instantiate a common class in a class library, and you can call public methods
-----------------------------------------------------------------------------
Commissioned:
Is the agent, the event is also a delegate, but is a special delegate;
1. Declaring the delegate type:
------
public delegate int Firstdel (int a, int b)
2, the definition of the delegate variable and the assignment value:
--------
public int Jiafa (int a, int b) { return a + b; }
-------
Firstdel f1 = new Fangfa (). Jiafa; int c = f1 (5, 4);
3, the use of the delegate variable:
Namespace delegate {public delegate int Firstdel (int a, int b);//Declare delegate type class program { static void Main (Strin G[] args) { Firstdel f1 = new Fangfa (). Jiafa; int c = f1 (5, 4); Console.WriteLine (c); Firstdel F2 = new Fangfa (). JIANFA; c = F2 (5, 4); Console.WriteLine (c); c = F1 (5, 4) + F2 (5, 4); Console.WriteLine (c); Console.readkey (); } }
Namespace Delegate { class Fangfa {public int Jiafa (int a, int b) { return a + b; } public int Jianfa (int a, int b) {return a-a ; }
Four-object-oriented-class library, delegate