以下の内容はhttps://baba-s.hatenablog.com/entry/2015/05/23/201728より取得しました。


【C#】引数にnullを渡してもエラーにならないContainsKeyの拡張メソッド

ソースコード

using System.Collections.Generic;

public static class DictionaryExtensions
{
    public static bool ContainsKeyNullable<TKey, TValue>( 
        this Dictionary<TKey, TValue> self, TKey key 
    )
    {
        if ( key == null )
        {
            return false;
        }
        return self.ContainsKey( key );
    }
}

関連記事




以上の内容はhttps://baba-s.hatenablog.com/entry/2015/05/23/201728より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14