Operator ??, that was introduced in the .NET 2.0, takes first place in my top used C# idioms list a long time, but unfortunately it is rarely used in projects I’ve participated. Therefore these snippets could be found in production code very often:
1 2 3 4 5 | public string Caption { get { return ViewState["Caption"] != null ? (string) ViewState["Caption"] : ""; } set { ViewState["Caption"] = value; } } |