foreach (DictionaryEntry ide in this.urlAndLinks) 
{
foreach (DictionaryEntry idUr in this.keyWordHash)
{
if ((string)ide.Value != "" && (string)ide.Key != "")
{
string keyWord = (string)idUr.Key;
string filter = "\\D*" + keyWord + "\\D*";
Regex reg = new Regex(filter,RegexOptions.IgnoreCase);
string titleInIDE = (string)ide.Value;
try 
{
Match match =  reg.Match(titleInIDE);
}
catch (Exception ee)
{
throw (new ArgumentException(ee.Message));
}
查了下该方法,似乎不抛出错误啊?请大家教教!

解决方案 »

  1.   

    对CSDN失去信心呢!这几天问了几个问题,到现在为止还没有一个回答..连UP都只有很少的几个..
    下面进来的朋友请推荐几个其他的论坛吧!!!-_-
      

  2.   

    make sure titleInIDE is not nulltitleInIDE = (string)ide.Value;
    Console.WriteLine(titleInIDE != null);
      

  3.   

    try 
    {
          Match match =  reg.Match(titleInIDE);
    }
    catch (Exception ee)
    {
          throw (new ArgumentException(ee.Message));
    }
    是包含在下面的if 语句里面的.
    if ((string)ide.Value != "" && (string)ide.Key != "")
    {
    string titleInIDE = (string)ide.Value;
    }
    应该不存在titleInIDE == NULL的可能性啊??
    因为是用作类库的.所以只能呆会测试了..汗!
      

  4.   

    问题解决了.
    if (ide.Value != null && ide.Key != null && ide.Value != "" && ide.Key != "")
    可是我还是有个问题.如果ide.Value == null的话.ide.Value != ""为什么不会报错了?谢谢回答.