WebService

w891986617 2013-05-09 10:20:29
自己写了个ASP.NET Web服务应用程序,里面有个参数是自己写的一个Dictionary,在运行的时候就报必须在 System.Collections.Generic.Dictionary`2+KeyCollection[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] 上实现默认访问器,因为它继承自 ICollection。
这个问题怎么解决,在线等答案

public class MyDictionary<TKey, TValue>
{
public MyDictionary()
{
this.InternalDicktionary = new Dictionary<TKey, TValue>();
}


protected Dictionary<TKey, TValue> InternalDicktionary { get; private set; }

public int Count { get { return this.InternalDicktionary.Count; } }

public Dictionary<TKey, TValue>.KeyCollection Keys { get { return this.InternalDicktionary.Keys; } }

public Dictionary<TKey, TValue>.ValueCollection Values { get { return this.InternalDicktionary.Values; } }

public TValue this[TKey key]
{
get { return this.InternalDicktionary[key]; }
set { this.InternalDicktionary[key] = value; }
}

public void Add(TKey key, TValue value)
{
this.InternalDicktionary.Add(key, value);
}

public void Clear()
{
this.InternalDicktionary.Clear();
}

public bool ContainsKey(TKey key)
{
return this.InternalDicktionary.ContainsKey(key);
}

public bool ContainsValue(TValue value)
{
return this.InternalDicktionary.ContainsValue(value);
}

public Dictionary<TKey, TValue>.Enumerator GetEnumerator()
{
return this.InternalDicktionary.GetEnumerator();
}


public bool Remove(TKey key)
{
return this.InternalDicktionary.Remove(key);
}

public bool TryGetValue(TKey key, out TValue value)
{
return this.InternalDicktionary.TryGetValue(key, out value);
}
}
上面是我Dictionary的代码
...全文
144 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧