【小5聊】C#基础之HttpPostedFileBase、HttpPostedFile、HttpPostedFileWrapper之间的关系
1、HttpPostedFile
2、HttpPostedFile
3、HttpPostedFileWrapper
由以上三个类可以知道
1)HttpPostedFileWrapper继承了HttpPostedFileBase
2)HttpPostedFileWrapper在自身构造函数里接收HttpPostedFile参数
3)三者成员是一样的,只是构造函数的不同
如果用到两者之间相互转换,那么根据以上关系可得
1)HttpPostedFile转换到HttpPostedFileBase
HttpPostedFileBase filebase=new HttpPostedFileWrapper(HttpPostedFile) as HttpPostedFileBase;
HttpPostedFileBase filebase=new HttpPostedFileWrapper(HttpPostedFile);
反之不可转换