如何在反序列化文件中搜索字符串关键字 [英] how search string keyword in deserialize file

查看:93
本文介绍了如何在反序列化文件中搜索字符串关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要反序列化文件中的搜索关键字,我该怎么做>> ???

i want search keyword in deserialize file how can i do it >>???

推荐答案

您可以在以下两种情况下使用此方法:
1)查找第一个匹配项,然后退出
2)查找所有出现的事件,并能够报告行号

You can use this approach for both of the following scenarios:
1) Look for the first occurrence and then exit
2) Look for all occurrences and be able to report line numbers

foreach (string line in File.ReadAllLines(@"your-file.txt"))
{
  // check for matching string and process accordingly
}



您需要为System.IO添加using.

干杯.



You''ll need to add a using for System.IO.

Cheers.


这篇关于如何在反序列化文件中搜索字符串关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆