Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

How to check for null in var object

$
0
0

I have a var object as follows:

  var files = HttpContext.Request.Form.Files;

In my form, I'm allowing the user to state the local paths of 10 pictures I want uploaded to the form, where

the first 3 paths are set, and the remaining 7 are still null.

This doesn't work:

       if (!string.IsNullOrWhiteSpace(files[4].FileName)) files[4].CopyTo(filestream);

How can I get this right?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>