Comment éviter clé null erreurs dans le dictionnaire?

Comment éviter d'erreur si la clé est null?

//Getter/setter
public static Dictionary<string, string> Dictionary
{
    get { return Global.dictionary; }
    set { Global.dictionary = value; }
}

Mise à JOUR:

Dictionary.Add("Key1", "Text1");
Dictionary["Key2"] <-error! so what can I write in the GET to avoid error?

Grâce.

ce qui concerne

  • Le code ne correspond pas à la question... Où est la clé?
InformationsquelleAutor eman | 2010-11-03