I have 2 classes which looks like this:
class Widget
{
    string Selected { get; set; }
    List<Option> Options { get; set; }
}
class Option
{
    string InternalCode { get; set; }
    string ExternalCode { get; set; }
}
Options gets populated dynamically with different data per client for showing ExternalCode as options
Selected gets populated with ExternalCode.
I then need to access the InternalCode which matches.
At present I am doing this:
var option = widget.Options.SingleOrDefault(o => o.ExternalCode == widget.Selected);
var internalCode = option == null ? string.Empty : option.InternalCode;
Is this possible using a single line using Null Coalesce?
 
     
     
     
     
    