本文介绍了SearchResultCollection转换为CSV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么简单的方法可以将我的结果(SearchResultCollection)的内容导出到CSV文件?
Is there any easy way to export the contents of my results (SearchResultCollection) to a CSV file?
还是我必须迭代每个结果并将其附加到文本文件中?
or do I have to Iterate each result and Append it to a text file?
推荐答案
No, there is no better option than iterating the SearchResultCollection
and writing it to a text-file.
using (StreamWriter w = File.AppendText(path))
{
foreach (SearchResult result in allSearchResults)
{
w.WriteLine(string.Format("Path={0} Properties={1}"
, result.Path
, string.Join(",", result.Properties.PropertyNames));
}
}
这篇关于SearchResultCollection转换为CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!