CustomerEntity innerModel = model as CustomerEntity;是什么意思?
CustomerEntity 这个是类名 innerModel 是new对象  吗? model as CustomerEntity

解决方案 »

  1.   

    1。
    as,是C#中提供的显示转换操作符具体参考:
    http://msdn2.microsoft.com/zh-cn/library/cscsdfbt(VS.80).aspx
    2。
    CustomerEntity innerModel = model as CustomerEntity;
    ==========
    表示 对象变量 model 强制转换为 CustomerEntity功能上等同于CustomerEntity innerModel = (CustomerEntity)model;区别在于,当 model 是一个无法转换为 CustomerEntity 的对象时候,
    前者,直接返回 null (空引用)
    后者,直接丢出转换无效异常 System.InvalidCastException
      

  2.   

    CustomerEntity innerModel = model as CustomerEntity;把一个model对象转换为CustomerEntity类的对象,如果成功,将其引用地址赋给CustomerEntity类的引用innerModel,如果失败,innerModel返回null