CustomerEntity innerModel = model as CustomerEntity;是什么意思?
CustomerEntity 这个是类名 innerModel 是new对象 吗? model as CustomerEntity
CustomerEntity 这个是类名 innerModel 是new对象 吗? model as CustomerEntity
解决方案 »
- 登录时报错 ‘null’为空或不是对象
- DataView 绑定问题
- 把winform嵌入到webform中的问题.....100分求救
- 谁知道interdev开发工具哪有下载?多大的?
- webform , vb.net ,datagrid下面分页的数字,怎样设置才能靠左?
- 应用code-behind技术,是不是所有的客户端脚本也要写在code-behind文件里,就像这样……
- 错误:创建在“system.net/defaultProxy”配置节中指定的 Web 代理时出错
- 求网上书吧(类似起点)的数据库设计
- 火线求救阿!为什么我应用EXCEL组件后,运行会出现如下问题,该如何解决??????
- 如何用复选框控制按钮
- 求一段好用的限制标题长度的
- 一个简单的往数据库添加的问题
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