我有一个大字符串要阅读,它总是不同的,但一个词总是相同的。这个词是MESSAGE
,所以如果我的字符串阅读器遇到这个词,它必须将整个字符串写入磁盘。我做了一些代码,但它不起作用,if 段永远不会触发,这里有什么问题?
string aLine;
StringReader strRead = new StringReader(str);
aLine = strRead.ReadLine();
if (aLine == "MESSAGE")
{
//Write the whole file on disc
}