SortedList的用法问题

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吗?

幕布斯6054654
浏览 570回答 1
1回答

ABOUTYOU

SortedListSortedList<TKey, TValue>这是两个类型,同时 SortedList<TKey, TValue>&nbsp;同 SortedList之间没有任何关系。
打开App,查看更多内容
随时随地看视频慕课网APP