2011年11月15日

BeginInvoke

摘要: using System;using System.Threading;namespace ConsoleApplication1{ class BeginInvoke { private delegate int NewTaskDelegate(int ms); static void Main44() { NewTaskDelegate task = new NewTaskDelegate(newTask);//委托实例 IAsyncResult asyncResult = task.BeginInvoke(2000, new AsyncCallback(CallBackMethod11) 阅读全文

posted @ 2011-11-15 22:29 breakpoint 阅读(409) 评论(0) 推荐(0) 编辑

IsTestedAttribute

摘要: //Copyright (C) Microsoft Corporation. All rights reserved.// AttributesTutorial.cs// This example shows the use of class and method attributes.using System;using System.Reflection;using System.Collections;// The IsTested class is a user-defined custom attribute class.// It can be applied to any dec 阅读全文

posted @ 2011-11-15 22:28 breakpoint 阅读(92) 评论(0) 推荐(0) 编辑

AttributesSample.

摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;namespace ConsoleApplication1{ /// <summary> /// AttributeTargets.Class表示我们自定义的属性只能用于类上。 /// </summary> [AttributeUsage(AttributeTargets.Class)] public class MyCustomAttribute : Attr 阅读全文

posted @ 2011-11-15 22:28 breakpoint 阅读(89) 评论(0) 推荐(0) 编辑

AnonymousDelegate_Sample

摘要: //Copyright (C) Microsoft Corporation. All rights reserved.using System;using System.Collections.Generic;using System.Text;namespace AnonymousDelegate_Sample{ // Define the delegate method. delegate decimal CalculateBonus(decimal sales); // Define an Employee type. class Employee { public string nam 阅读全文

posted @ 2011-11-15 22:28 breakpoint 阅读(102) 评论(0) 推荐(0) 编辑

AbstractClass

摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{ abstract class AbstractClass //抽象类可以包括抽象方法,这是普通类所不能的 ,抽象方法只能声明于抽象类中,且不包含任何实现,派生类必须覆盖它们。 //好的接口定义应该是具有专一功能性的,而不是多功能的,否则造成接口污染。如果一个类只是实现了这个接口的中一个功能,而不得不去实现接口中的其他方法,就叫接口污染 { //当在差异较大的对象间寻求功能 阅读全文

posted @ 2011-11-15 22:27 breakpoint 阅读(197) 评论(0) 推荐(0) 编辑

EchoServer

摘要: using System;using System.Net.Sockets;using System.IO;using System.Net;namespace ConsoleApplication1{ class EchoServer { public static void Main11() { // TcpListener监听端口1234 IPAddress ipAd = IPAddress.Parse("192.168.1.158"); TcpListener tcpListener = new TcpListener(ipAd,5555); tcpListener 阅读全文

posted @ 2011-11-15 22:26 breakpoint 阅读(133) 评论(0) 推荐(0) 编辑

DateClient

摘要: class DateClient { //the needed member feilds private TcpClient tcpc; private string name; private int port = 4554; private bool readData = false; public DateClient(string name) { //a label tryagain: this.name = name; try { //connect to the "localhost" at the give port //if you have some o 阅读全文

posted @ 2011-11-15 22:23 breakpoint 阅读(144) 评论(0) 推荐(0) 编辑

DateServer

摘要: class DateServer { private TcpListener myListener; private int port = 8001; public DateServer() { try { //start listing on the given port myListener = new TcpListener(port); myListener.Start(); Console.WriteLine("Server Ready - Listining for new Connections ..."); //start the thread which 阅读全文

posted @ 2011-11-15 22:21 breakpoint 阅读(96) 评论(0) 推荐(0) 编辑

导航