I want to create a function to convert any null value e.g. from a database to an empty string.
I know there are methods such as if value != null ?? value : String.Empty but is there a way to pass null to a method e.g.
public string nullToString(string? value)
{
if(value == null) return empty;
return value
}
But I am not sure on the parameter syntax to do this.
I tried the above but it says not a nullable type.
1 Answer