0
我有一个WinForm
应用程序,正从由于历史决定逃/远程登录终端 输出,所有输出到这样的StringBuilder VS列表字符串搜索一行行C#
static List<string> BufferLog = new List<string>();
serialInputData += serialPort.ReadExisting();
BufferLog.Add(serialInputData);
列表时,现在,我想添加其他功能以阻止线程,直到一句{一个字也可以} 什么,我脑子里想的是做这样的事情
if (IsWaitForCustomMessage)
{
while(IsNotTimeout)
{
List<string> waiterList = serialInputData.Split('\n').ToList();
if (waiterList.Exists(x => x.Contains("SomeSentenc")) return true ;
}
return false;
}
假设serialInputData
不是合作挨一条线,但有很多行
我想知道的是,有没有更快的方法来检查这些行?
其他唯一的办法做到这一点很简单,我是stringBuilder
,我更愿意将尝试其他方式
也来回您的经验,我应该改变从List<string>
的BufferLog
一些其他类型的?
Dow!我在这件事情上让我感到不安,因为我在这件事上遇到了麻烦。谢谢 – LordTitiKaka 2014-09-29 13:44:39