How can I tell compiler that the following extension method returns not null if input is not null?
public static string? SomeMethod(this string? input)
{
if (string.IsNullOrEmpty(input))
return input;
// Do some work on non-empty input
return input.Replace(" ", "");
}
[return: NotNullIfNotNull("input")]
before the mehtod. – Irena