文档介绍:编程: 1、定义并实现一个接口: interface IDimensions { float getLength(); float getWidth(); } class Box : IDimensions { float lengthInches; float widthInches; Box( float length, float width) { lengthInches = length; widthInches = width; } float IDimensions .getLength() { return lengthInches; } float IDimensions .getWidth() { return widthInches; } static void Main() { Box box1 = new Box (, ); IDimensions dimensions =( IDimensions )box1; System. Console .WriteLine( "Len gth: {0}" , ()); System. Console .WriteLine( "Wid th: {0}" , ()); }}2、委托: public delegate void Del(string message); // Create a method for a delegate. public static void DelegateMethod(string message) { (m essage); } // Instantiate the delegate. Del handler = DelegateMethod; // Call the delegate. handler("Hello World"); public void MethodWithCallback(int param1, int param2, Del callback) { callback("The number is: "+ (param1 + param2).ToString()); } MethodWithCallback(1, 2, handler); 3、异步调用 using System; using ; namespace AsyncDemo { class AsyncDemo {[ STAThread ] static void Main( string [] args) { AsyncDemo ad= new AsyncDemo (); (); Console .Read(); } string LongRunningMethod( int iCallTime, out int iExecThread) { Thread .Sleep(iCallTime); iExecThread = AppDomain .GetCurrentThreadId() ; return "MyCallTime was "+