我想在Dictionary的值用List类型的,就像下面这样写,报找不到类型或命名空间名称 T,写法如下:
private static Dictionary<string, IList<T>> _mappingCache = new Dictionary<string, IList<T>>();
请问该怎么改?
private static Dictionary<string, IList<T>> _mappingCache = new Dictionary<string, IList<T>>();
请问该怎么改?
Dictionary<string, IList<String>> _mappingCache = new Dictionary<string, IList<String>>();把IList<T>换成IList<你的类型>
private static void aa<T>()
{
Dictionary<string, IList<T>> _mappingCache = new Dictionary<string, IList<T>>();
}
Dictionary<string, IList<T>> _mappingCache = new Dictionary<string, IList<T>>();
//调用的时候MyDictionary["one"]=List<你的类型名>(); //可以是string,自定义class,int,decimail.........【List<你的类型名>()】代表一个类型的数组
Dictionary<string, IList<T>> _mappingCache = new Dictionary<string, IList<T>>();
{
}
Dictionary<string, IList<T>> _mappingCache = new Dictionary<string, IList<object>>();
改成这样就行了,任意类型。