易截截图软件、单文件、免安装、纯绿色、仅160KB

接口(C# 参考)

以下参考 :http://msdn.microsoft.com/zh-cn/library/87d83y5b.aspx
接口(C# 参考)
更新:2007 年 11 月
接口只包含方法、属性、事件或索引器的签名。成员的实现是在实现接口的类或结构中完成的,如下面的示例所示:
示例
interface ISampleInterface
{
    void SampleMethod();
}
class ImplementationClass : ISampleInterface
{
    // Explicit interface member implementation:
    void ISampleInterface.SampleMethod()
{
// Method implementation.
    }
    static void Main()
    {
        // Declare an interface instance.
        ISampleInterface obj = new ImplementationClass();
        // Call the member.
        obj.SampleMethod();
    }
}
接口可以是命名空间或类的成员,并且可以包含下列成员的签名:
方法
属性
索引器
事件
一个接口可从一个或多个基接口继承。
当基类型列表包含基类和接口时,基类必须是列表中的第一项。
实现接口的类可以显式实现该接口的成员。显式实现的成员不能通过类实例访问,而只能通过接口实例访问。
有关显式接口实现的更多详细信息和代码示例,请参见显式接口实现(C# 编程指南)。
下面的示例演示了接口实现。在此示例中,接口包含属性声明,类包含实现。
interface IPoint
{
   // Property signatures:
   int x
   {
      get;
      set;
   }
   int y
   {
      get;
      set;
   }
}
class Point : IPoint
{
   // Fields:
   private int _x;
   private int _y;
   // Constructor:
   public Point(int x, int y)
   {
      _x = x;
      _y = y;
   }
   // Property implementation:
   p


相关文档:

c#启动Sql Server服务

程序启动Sql Server其实很简单
代码:
System.ServiceProcess.ServiceController   myController   =
new   System.ServiceProcess.ServiceController("MSSQL$ACCP4444"); //服务名称 找了半天才找到,笨死我完了。在服务上右键属性,能看到
if (myController.CanStop)
{ }
else ......

ASP.NET C# URL加密解密

需要引用的类名空间
using System.Security.Cryptography;
using System.IO;
using System.text;
 
        /// <summary>
        /// 加密
        // ......

asp.netc#Access通用数据访问类

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
/// <summary>
/// Data ......

abstract(C# 参考)

//以下来自:http://msdn.microsoft.com/zh-cn/library/sf985hc5.aspx
abstract(C# 参考)
更新:2007 年 11 月
abstract 修饰符可以和类、方法、属性、索引器及事件一起使用。在类声明中使用 abstract 修饰符以指示某个类只能是其他类的基类。标记为抽象或包含在抽象类中的成员必须通过从抽象类派生的类来实现。
示例 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号