各位好,小弟刚学习c#,想请教一个关于hashtable方法的问题
我有一个文本文件file,然后用File.ReadAllLines将file中的每行内容读入到一个string【】中去
现在我想建一个一个hashtable ht,他的key是file中的一个word,value是这个file中出现出现word的句子,比如s1,s2,sn....
不晓得这个方法该怎么使用呢?
谢谢。

解决方案 »

  1.   

    Hashtable hashTable = new Hashtable();
                hashTable ["key1"] = value1;
                hashTable ["key2"] = value2;
      

  2.   

    你的file是什么格式的。发上来看看
      

  3.   

    Hashtable hashTable = new Hashtable(); 
                hashTable ["key1"] = value1; 
                hashTable ["key2"] = value2;
      

  4.   


    Summary: The protein encoded by this gene is a plasma glycoprotein of unknown function. The protein shows sequence similarity to the variable regions of some immunoglobulin supergene family member proteins. [provided by RefSeq]
    GeneRIF: A1BG-cysteine-rich secretory protein 3 complex displays a similar function in protecting the circulation from a potentially harmful effect of free CRISP-3file就是一行一句话
    多谢
      

  5.   

    还是多谢
    这个简单的构造我知道的
    我想我的要求是(key, arraylist【】)
    arrylist成员应该是一个个句子。
      

  6.   

    运行时,出现下面的提示,会是什么原因呢?
    c# the program‘[2284] base.vshost.exe: Managed' has exited with code 0 (0x0)
    多谢。
      

  7.   

    ArrayList   al=new   ArrayList();   
    HashTable   ht=new   HashTable();   
    ht.Add("",al);   
    ArrayList   al=ht[key]   as   ArrayList;