csharp读取txt添加收藏集写入txt如何? [英] csharp read txt add collection write txt how ?

查看:68
本文介绍了csharp读取txt添加收藏集写入txt如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想读取一个txt文件并将所有单词添加到集合中,但是在该集合写入txt后不要添加相同的单词.我该怎么做.我可以使用不同的单词收集方法吗.

I want to read a txt file and add all words to a collection but dont add same words after write txt by the collection. how I do it. May I use how collection for different words.

推荐答案

我们不会为您做功课,但是我会给您一些指导. > 1)阅读时,您需要一个收集对象来将单词放入.
2)在将找到的单词实际插入到集合中之前,您需要确保该单词在集合中不存在. (提示:为此使用集合的内置方法)
We''re not going to do your homework for you, but I will give you some pointers.
1) You''ll need a collection object to put the words into as you read them.
2) Before you actually insert a found word into the collection, you''ll need to make sure that the word doesn''t already exist in the collection. (Hint: Use a built in method of the collection for this)


这篇关于csharp读取txt添加收藏集写入txt如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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