I have the following PageViewModel class:
public class PageViewModel : ViewModel<Page>
{
public PageViewModel ()
{
Kywords = new List<Keyword>();
AnswserKeywordDictionary = new Dictionary<string, Answer>();
}
public Company Company { get; set; }
public List<Keyword> Kywords { get; set; }
public Dictionary<string, Answer> AnswserKeywordDictionary { get; set; }
}
In my view i'm using the property AnswserKeywordDictionary like that:
@Html.DisplayAffirmativeAnswer(Model.AnswserKeywordDictionary["myKey"])
my question is : how can i return a default value if "myKey" is not in the dictionary.
Thanks in advance