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

C#进阶

C#重载和非重载运算符

11

usingSystem;namespaceOperatorOvlApplication{classBox{privatedoublelength;//Lengthofaboxprivatedoublebreadth;//Breadthofa

C#初始化基类

8

usingSystem;namespaceRectangleApplication{classRectangle{//membervariablesprotecteddoublelength;protecteddoublewidth;pub

C#数据类型

16

usingSystem;namespaceDataTypeApplication{classProgram{staticvoidMain(string[]args){Console.WriteLine("Sizeofint:{0}

C#其他运算符

6

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

C#数组复制

7

usingSystem;namespaceArrayApplication{classMyArray{staticvoidMain(string[]args){int[]n=newint[10];/*nisanarrayof10intege

C#嵌套循环

13

usingSystem;namespaceLoops{classProgram{staticvoidMain(string[]args){/*localvariabledefinition*/inti,j;for(i=2;i<100;

C#数组声明

7

usingSystem;namespaceMyApplication{classMyClass{staticvoidMain(string[]args){//nisanarrayof5integersint[]a=newint[5];int

C#SortedList类

10

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

C#属性和方法

11

#defineDEBUGusingSystem;usingSystem.Diagnostics;publicclassDemo{[Conditional("DEBUG")]publicstaticvoidMessage(

C#类型转换方法

12

usingSystem;namespaceTypeConversionApplication{classStringConversion{staticvoidMain(string[]args){inti=75;floatf=53.005f

C#二进制转为十进制

8

usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceDemo{classtoBinary{staticvoidMain(string[]args){in

C#将数组作为函数参数传递

8

usingSystem;namespaceArrayApplication{classMyArray{doublegetAverage(int[]arr,intsize){inti;doubleavg;intsum=0;for(i=0;i&

C#命名空间使用关键字

13

usingSystem;usingfirst_space;usingsecond_space;namespacefirst_space{classabc{publicvoidfunc(){Console.WriteLine("In

C#抽象和虚拟类

7

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

C#正则表达式示例2

5

usingSystem;usingSystem.Text.RegularExpressions;namespaceRegExApplication{classProgram{privatestaticvoidshowMatch(string

C#嵌套if语句

6

usingSystem;namespaceDecisionMaking{classProgram{staticvoidMain(string[]args){//*localvariabledefinition*/inta=100;intb=

C#销毁线程

11

usingSystem;usingSystem.Threading;namespaceMultithreadingApplication{classThreadCreationProgram{publicstaticvoidCallToCh

C#条件指令

9

#defineDEBUG#defineVC_V10usingSystem;publicclassTestClass{publicstaticvoidMain(){#if(DEBUG&&!VC_V10)Console.Writ

C#冒泡排序程序

8

usingSystem;namespaceBubbleSort{classMySort{staticvoidMain(string[]args){int[]arr={78,55,45,98,13};inttemp;for(intj=0;j&