以下のような拡張メソッドがあります。
public static T GetValueAs<T, R>(this IDictionary<string, R> dictionary, string fieldName)
    where T : R
{
    R value;
    if (!dictionary.TryGetValue(fieldName, out value))
        return default(T);
    return (T)value;
}
現在、次の方法で使用できます。
    var dictionary = new Dictionary<string, object>();
    //...
    var list = dictionary.GetValueAs<List<int>, object>("A"); // this may throw ClassCastException - this is expected behavior;
これはかなり問題なく動作しますが、2 番目の型パラメーターは非常に厄介です。C# 4.0 で GetValueAs を書き直すことは可能ですか? メソッドがさまざまな種類の文字列キー辞書に適用可能であり、呼び出しコードで 2 番目の型パラメーターを指定する必要がありません。つまり、使用します。
    var list = dictionary.GetValueAs<List<int>>("A");
または少なくとも次のようなもの    var list = dictionary.GetValueAs<List<int>, ?>("A");
それ以外の    var list = dictionary.GetValueAs<List<int>, object>("A");