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));
}
查了下该方法,似乎不抛出错误啊?请大家教教!
{
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));
}
查了下该方法,似乎不抛出错误啊?请大家教教!
下面进来的朋友请推荐几个其他的论坛吧!!!-_-
Console.WriteLine(titleInIDE != null);
{
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的可能性啊??
因为是用作类库的.所以只能呆会测试了..汗!
if (ide.Value != null && ide.Key != null && ide.Value != "" && ide.Key != "")
可是我还是有个问题.如果ide.Value == null的话.ide.Value != ""为什么不会报错了?谢谢回答.