use ?. and ?? instead of if == null

This commit is contained in:
弘韬 张 2020-10-20 08:28:05 +08:00
parent 468f8899b9
commit 4d06187fa5

View file

@ -48,11 +48,7 @@ namespace Flow.Launcher.Infrastructure
query = query.Trim();
if (_alphabet != null)
{
query = _alphabet.Translate(query);
stringToCompare = _alphabet.Translate(stringToCompare);
}
stringToCompare = _alphabet?.Translate(stringToCompare) ?? stringToCompare;
// This also can be done by spliting the query