not-blond-beard/Savor-22b

NotFoundTableDateException null handling 중복 줄이기

Closed this issue · 0 comments

    private Recipe FindRecipeInCsv(int recipeID)
    {
        var recipe = CsvDataHelper.GetRecipeById(recipeID);

        if (recipe is null)
        {
            throw new NotFoundTableDataException(
                $"Invalid {nameof(recipeID)}: {recipeID}");
        }

        return recipe;
    }

이런 코드로 체크하는데 어떻게 잘 중복을 제거해봅시다...