List<string> excepted = ?
? 处的格式是什么类型的

解决方案 »

  1.   

    List<string>这个=是赋值,需要类型一致,或右边是左边的子类型。
      

  2.   

    那当然是List<string>类型的
      

  3.   

    泛型   new list<string>();
      

  4.   

    List<string>这么明显的啊。。前面不是告诉你了吗
      

  5.   

    List<string> excepted = new List<string> excepted();
    这是 这个泛型 string 的实例
     
      

  6.   

     我做的是个测试,调用的方法是读取一个Path,用excepted= 表示我期望的值,我不知道excepted = ?怎么表示我期望的路径
      

  7.   

      看来你还是没白
      List<string> excepted= ?
     这是一个泛型集合  你只能这样
      将你的path 读取之后赋值 给另外一个 list<string>
     也就是这样 
       List<string> excepted = new List<string> excepted();
     excepted[0]= path;
      

  8.   

    这还用测试吗...这是最最基础的语法知识,跟泛型一点关系都没有...声明是什么就只能是什么,及其可隐式转换类型...而List<string>在CLR中没有任何可转换的类型,所以没有任何其他解释...
      

  9.   


    public class MyStringList : List<string>
    {
        public void Foo() { MessageBox.Show("^_^"); }
    }List<string> test = new MyStringList();
      

  10.   

    List<string> excepted = new List<string>();
    excepted.Add("测试");
      

  11.   

    List<string> excepted = ?能够赋值的是继承自IList接口的所有子类
      

  12.   

    List<string> excepted = new List<string>();
    excepted.Add("测试");
      

  13.   

    楼主,我懂你的意思,你是在做VS带的单元测试。expected的值可以返回一个IList<string>现在推崇面向接口编程,IList<T>是一个接口,List<T>实现了该接口。