为了账号安全,请及时绑定邮箱和手机立即绑定

SortedList的用法问题

SortedList的用法问题

幕布斯6054654 2018-07-27 17:09:37
using System;using System.Collections.Generic;public class SiteList {       protected SortedList<int, string> sites;       //其他成员函数        public string this[int index]        {              get               {                    if(index>sites.Count)                        return (string)null;                    return (string)sites.GetByIndex(inex)              }         }       //其他东西 }这里VS提示“找不到GetByIndex的定义”,但是如果把using 中的Generic去掉的话,原来的“找不到定义”消失,却又提示“非泛型 类型“System.Collections.SortedList”不能与类型实参一起使用”,难道带参数的SortedList不是继承不带参数的SortedList吗?
查看完整描述

1 回答

?
ABOUTYOU

TA贡献1812条经验 获得超5个赞

SortedList

SortedList<TKey, TValue>

这是两个类型,同时 SortedList<TKey, TValue> 同 SortedList之间没有任何关系。


查看完整回答
反对 回复 2018-07-30
  • 1 回答
  • 0 关注
  • 560 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信