Blog on software engineering
Use string.Format to handle strings that are empty or null

Use string.Format to handle strings that are empty or null

Console.WriteLine(string.Format("{0} [{1}]", "object1", null));

Result:

object1 []

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.