コンカレントディクショナリがあり、TryGetValueを試し、それが失敗するかどうかをテストする場合は、何かを行いますが、失敗しない場合、TryGetValue関数から取得される出力値は、TryGetValueを試す前の値と等しくなります。 、私は何か他のことをします。
私の質問は、(ConcurrentDicationaryの何もdefault(DateTime)に設定されないと仮定して)、2番目のifステートメントが実際に実行されるのでしょうか?それとも現在の状況を考えると不可能ですか?
var m_unitsWaitingForReadResponse = new ConcurrentDictionary<string, DateTime>();
DateTime outVal = default(DateTime);
if (!m_unitsWaitingForReadResponse.TryGetValue("teststring", out outVal))
{
//Do Stuff
}
if (outVal == default(DateTime))
{
//Do Stuff 2
}