当前位置:首页 > C#教程 > C#进阶

C#进阶

C#类的静态成员

3

usingSystem;namespaceStaticVarApplication{classStaticVar{publicstaticintnum;publicvoidcount(){num++;}publicintgetNum(){r

C#逻辑运算符

2

usingSystem;namespaceOperatorsAppl{classProgram{staticvoidMain(string[]args){boola=true;boolb=true;if(a&&b){Cons

C#主线程

4

usingSystem;usingSystem.Threading;namespaceMultithreadingApplication{classMainThreadProgram{staticvoidMain(string[]args)

C#Queue类

2

usingSystem;usingSystem.Collections;namespaceCollectionsApplication{classProgram{staticvoidMain(string[]args){Queueq=new

C#调用方法示例2

5

usingSystem;namespaceCalculatorApplication{classNumberManipulator{publicintFindMax(intnum1,intnum2){/*localvariabledecla

C#调用方法

3

usingSystem;namespaceCalculatorApplication{classNumberManipulator{publicintFindMax(intnum1,intnum2){/*localvariabledecla

C#基本语法

5

usingSystem;namespaceRectangleApplication{classRectangle{//membervariablesdoublelength;doublewidth;publicvoidAcceptdetai

C#抽象与虚拟动态多态

3

usingSystem;namespacePolymorphismApplication{classShape{protectedintwidth,height;publicShape(inta=0,intb=0){width=a;heig

C#双端队列类

5

usingSystem;publicabstractclassVehicle{publicabstractvoiddisplay();}publicclassBus:Vehicle{publicoverridevoiddisplay(){C

C#阶乘示例

2

usingSystem;namespaceMyApplication{classFactorial{publicintdisplay(intn){intres=1;while(n!=1){res=res*n;n=n-1;}returnres

C#使用索引器

2

usingSystem;namespaceIndexerApplication{classIndexedNames{privatestring[]namelist=newstring[size];staticpublicintsize=10

C#管理线程

5

usingSystem;usingSystem.Threading;namespaceMultithreadingApplication{classThreadCreationProgram{publicstaticvoidCallToCh

C#其他运算符

2

usingSystem;namespaceOperatorsAppl{classProgram{staticvoidMain(string[]args){/*exampleofsizeofoperator*/Console.WriteLin

C#构造函数

1

usingSystem;namespaceLineApplication{classLine{privatedoublelength;//LengthofalinepublicLine(){Console.WriteLine("O

C#字符串包含字符串

3

usingSystem;namespaceStringApplication{classStringProg{staticvoidMain(string[]args){stringstr="Thisistest";if(

C#计算字符串中的单词数

3

usingSystem;publicclassDemo{publicstaticvoidMain(){inta=0,myWord=1;stringstr="HelloWorld!";while(a<=str.Len

C#Hashtable类

3

usingSystem;usingSystem.Collections;namespaceCollectionsApplication{classProgram{staticvoidMain(string[]args){Hashtableh