实例化继承了接口:
namespace Air.Common.Air
{
    public class AirCityEntity : IAirCityEntity
    {
        public int Id { get; set; }
        public String Name { get; set; }
        public String Code{get;set;}
    }
}接口namespace Air.Common.Air.Interface
{
    public interface IAirCityEntity
    {
        int Id { get; set; }
        String Name { get; set; }
        String Code { get; set; }
    }
}
有什么用??/????/希望大家指点下``给个很直观的思想```
谢谢啊``````

解决方案 »

  1.   

    接口用于描述一组类的公共方法/公共属性,也就是说描述是某类事物的代码框架,而阁下所示代码,没有看出IAirCityEntity是一组类的框架,而仅仅是某个类的框架,这就实属画蛇添足,多此一举了。
      

  2.   

    我用在这了
     public IUserEntity GetEntity()
        {
            var entity = new UserEntity();
            var cookie = System.Web.HttpContext.Current.Request.Cookies[PageData.USER_ID];
            if (cookie != null)
            {
                Int32 uid = -1;
                if (Int32.TryParse(cookie.Value, out uid))
                {
                    entity.UserId = uid;
                }
                else
                {
                    return null;
                }
            }
      

  3.   

    抽象 解耦class Test1
    {
     private IAirCityEntity _ITest;
    }class Test2
    {
     private AirCityEntity _Test;
    }Test2依赖具体的AirCityEntity ,Test1 依赖抽象的接口IAirCityEntity 
    Test1 的实现可以脱离AirCityEntity 类