How to do ToString for a possibly null object?
string s = (myObjc ?? "").ToString()
How to do ToString for a possibly null object?
string s = (myObjc ?? "").ToString()
How to do ToString for a possibly null object?
string s = (myObjc ?? (Object)"").ToString()
string s = ((Object)myObjc ?? "").ToString()
How to do ToString for a possibly null object?
string s = myObj?.ToString() ?? "";
How to do ToString for a possibly null object?
string s = $"{myObj}";
How to do ToString for a possibly null object?
string s = (myObj ?? String.Empty).ToString();
How to do ToString for a possibly null object?
public static string ToStringNullSafe(this object value)
{
return (value ?? string.Empty).ToString();
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us