开发者

Best option for extracting string data?

I have a Portable Bridge Notation formatted-file that I have to work with. I have already a few simple examples working by using indexing and substrings extracting what I need and I suppose for this PBN business it would suite me well since it isn't run too often. If I one the other hand would run that code like all the time (thinking of working with vCards) then I am worried about memory usage under high workload because of the high amout of temporary string variables created from all substrings and splits.

There are two other options available that I know of. Regex and StringReader / TextReader and I wante开发者_如何学JAVAd some general opinion on what to use.

Intended usage is to extract to objects and serialize to json so that I can more easily work with or persist this information. Hell if it's fast enough I might even do it on the fly.

So hit me, what would you chose?


Personally, I would read the file line by line and store it in an internal representation and then query it with LINQ.

The advantage of storing to an internal representation is that you just read the file from top to bottom, so that just easy. And when you need to query, you have powerful linq queries, which make life a lot easier.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜