richandy

 

C# Basics

一、变量命名规范:

//int整型,前面加i

int iAge=25;

//long整型,前面加l

long lSN=201010010001;

//double浮点型,前面加d            

double dWage=800.10;

//decimal浮点型,前面加m

decimal mTotal=10020.34;      

//bool逻辑型,前面加is

bool isLogin=false;      

//char字符型,前面加c

char cAnswer='y';                   

//string字符串型,前面加s

string sUserName="andy";      

//object对象型,前面加o

object oReturnValue=1;            

 

二、启动进程:

System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.FileName = "calc.exe";
process1.Start();

System.Diagnostics.Process.Start("calc.exe");

 

三、启动线程:

Thread threadChatListen = new Thread(ChatListen);
threadChatListen.Start();

private void ChatListen()
{
    while (true)
    {
        TcpClient tcpClient = serverChatListener.AcceptTcpClient();
        if (tcpClient.Connected)
        {
            Thread threadChatClient = new Thread(ChatClientConnect);
            threadChatClient.Start(tcpClient);
        }
    }
}

private void ChatClientConnect(object sender)
{
    TcpClient tcpClient = sender as TcpClient;
    Application.Run(new FrmChat(tcpClient, this.Text, null, "ConnectOpen",null));
}

posted on 2010-09-24 09:02  richandy  阅读(92)  评论(0)    收藏  举报

导航