コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

2015-05-23から1日間の記事一覧

【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 ); } } </tkey,></tkey,>…