S
shapper
Hello,
On a method I have the following:
if (slide == null)
return File("~/resources/image/defaultslide.jpg", "image/jpg");
else
return File(slide.Image, "image/jpg");
But if I use:
return slide == null ? File("~/resources/image/defaultslide.jpg",
"image/jpg") : File(slide.Image, "image/jpg");
I get the error:
Type of conditional expression cannot be determined because there is
no implicit conversion between 'System.Web.Mvc.FilePathResult' and
'System.Web.Mvc.FileContentResult'
File is described here:
http://msdn.microsoft.com/en-us/library/system.web.mvc.fileresult.aspx
Please see the Inheritance Hierarchy:
System.Object
System.Web.Mvc.ActionResult
System.Web.Mvc.FileResult
System.Web.Mvc.FileContentResult
System.Web.Mvc.FilePathResult
System.Web.Mvc.FileStreamResult
Shouldn't my code work?
Thanks,
Miguel
On a method I have the following:
if (slide == null)
return File("~/resources/image/defaultslide.jpg", "image/jpg");
else
return File(slide.Image, "image/jpg");
But if I use:
return slide == null ? File("~/resources/image/defaultslide.jpg",
"image/jpg") : File(slide.Image, "image/jpg");
I get the error:
Type of conditional expression cannot be determined because there is
no implicit conversion between 'System.Web.Mvc.FilePathResult' and
'System.Web.Mvc.FileContentResult'
File is described here:
http://msdn.microsoft.com/en-us/library/system.web.mvc.fileresult.aspx
Please see the Inheritance Hierarchy:
System.Object
System.Web.Mvc.ActionResult
System.Web.Mvc.FileResult
System.Web.Mvc.FileContentResult
System.Web.Mvc.FilePathResult
System.Web.Mvc.FileStreamResult
Shouldn't my code work?
Thanks,
Miguel