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

This commit is contained in:
弘韬 张 2020-10-20 08:28:05 +08:00 committed by 张弘韬
parent 272f411f81
commit 787e569604

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