0
我该如何实现这样的功能。我不想要返回铸造值的方法,我想用this[]
这可能吗?在字典中通用此索引属性
public class DynamicDictionary : IDictionary<string, object>
{
public T this<T>[string key] where T : class
{
get
{
object value = null;
TryGetValue(key, out value);
return (T)value;
}
}
// ...
}