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

Not all code Paths Return a value

$
0
0

How can I initialize the variable query  before try --catch statement. Please help

 public Comedian[] GetComedians()
        {
            try
            {
                _logger.LogInformation($"Getting all comedians");
                var query = _db.Comedians
                            .OrderBy(c => c.LastName);
                //return query.ToArray();

            }
            catch(Exception ex)
            {

            }
          return query.ToArray(); // How can I return the variable query here

          
        }


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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