Replace chained LINQ calls with call to overload with predicate.

This simplifies the code by reducing the number of enumerators created
while also making the code slightly more readable.
This commit is contained in:
Kenneth Hsu
2018-10-06 16:20:18 -07:00
parent 439e319061
commit 0c1ac9c489
26 changed files with 46 additions and 46 deletions
@@ -23,7 +23,7 @@ namespace Duplicati.Server.WebServer.RESTMethods
{
public void POST(string key, RequestInfo info)
{
var m = Duplicati.Library.DynamicLoader.WebLoader.Modules.Where(x => x.Key.Equals(key, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
var m = Duplicati.Library.DynamicLoader.WebLoader.Modules.FirstOrDefault(x => x.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
if (m == null)
{
info.ReportClientError(string.Format("No such command {0}", key), System.Net.HttpStatusCode.NotFound);