1、HttpPostedFile

【小5聊】C#基础之HttpPostedFileBase、HttpPostedFile、HttpPostedFileWrapper之间的关系

2、HttpPostedFile

【小5聊】C#基础之HttpPostedFileBase、HttpPostedFile、HttpPostedFileWrapper之间的关系

3、HttpPostedFileWrapper

【小5聊】C#基础之HttpPostedFileBase、HttpPostedFile、HttpPostedFileWrapper之间的关系

由以上三个类可以知道

1)HttpPostedFileWrapper继承了HttpPostedFileBase

2)HttpPostedFileWrapper在自身构造函数里接收HttpPostedFile参数

3)三者成员是一样的,只是构造函数的不同

如果用到两者之间相互转换,那么根据以上关系可得

1)HttpPostedFile转换到HttpPostedFileBase

HttpPostedFileBase filebase=new HttpPostedFileWrapper(HttpPostedFile) as HttpPostedFileBase; 

HttpPostedFileBase filebase=new HttpPostedFileWrapper(HttpPostedFile);

反之不可转换

 

相关文章:

  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2022-12-23
  • 2021-12-15
  • 2021-05-07
猜你喜欢
  • 2021-08-01
  • 2021-06-09
  • 2021-12-23
  • 2022-12-23
  • 2022-01-13
  • 2021-09-02
  • 2022-12-23
相关资源
相似解决方案