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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user