公告版位
需要找什麼嗎? 左邊分類或許可以幫助你...

using System.Timers;

public static void Main (string[] args){

    System.Timers.Timer t = new System.Timers.Timer(1000);
    t.Elapsed += new ElapsedEventHandler(run);
    t.Enabled = true;

}

 

public static void run(object source,System.Timers.ElapsedEventArgs e){

    Console.WriteLine("OK");

黃彥霖 發表在 痞客邦 留言(0) 人氣()

//-- HashSet----------------------------------------

//無順序,但是加入相同物件的資料 會被過濾掉

import java.util.*;
public class SetTest{
    public static void main(String[] args){
        HashSet hs=new HashSet();
        hs.add(8);
        hs.add("darban");
        hs.add(3.14159);
        hs.add(new Date());

黃彥霖 發表在 痞客邦 留言(0) 人氣()

public static void main(String [] args){

    int a = 5;

    if(a==5){

        System.out.println("中斷啦");

        return;

    }

    System.out.println("程式沒有中斷");

//-----------------------------------------------------

//--  語法 :     assert <布林值> : <輸出>;

黃彥霖 發表在 痞客邦 留言(0) 人氣()

//  此方法會編譯錯誤,因為 return 可能不執行

int run(int a){

    if(a > 0){

        return 0;

    }

}


黃彥霖 發表在 痞客邦 留言(0) 人氣()

Socket cli;

while(true){

    // 接收到的資料

    byte [] b = new byte[1024];

    int i = cli.Receive(b, 0, b.Length, SocketFlags.None);

 

    // 傳送的資料

    byte[] msg = Encoding.ASCII.GetBytes("ABCD");

    int bytesSend = cli.Send(msg, 0, msg.Length, SocketFlags.None);

黃彥霖 發表在 痞客邦 留言(0) 人氣()