Ho il seguente:Perché nullable KeyValuePair <,> non ha alcuna proprietà chiave?
KeyValuePair<string, string>? myKVP;
// code that may conditionally do something with it
string keyString = myKVP.Key;
// throws 'System.Nullable<System.Collections.Generic.KeyValuePair<string,string>>'
// does not contain a definition for 'Key'
Sono sicuro che c'è qualche ragione per questo, come posso vedere che il tipo è nullable. È perché sto tentando di accedere alla chiave quando null
potrebbe causare problemi?
Non getta, si ottiene un errore di compilazione. –