开发者

accessing files in a particular folder in a window application

开发者 https://www.devze.com 2023-01-07 04:46 出处:网络
I want to select multiple files based开发者_开发问答 on their specific contents from a particular folder and edit their contents. I am using winform in C#.

I want to select multiple files based开发者_开发问答 on their specific contents from a particular folder and edit their contents. I am using winform in C#.

any idea which are the classes that can be used.

It would be helpful if code given for example.

thanks.


have a look at Directory.GetFiles to get to the names of the files in a directory. If they're text files you can read them via File.ReadAllLines (returnsan array of strings, one per line of the file) or File.ReadAllText (returns a single string containing the entire content of the file).

To save the edited files have a look at File.WriteAllLines or File.WriteAllText.

0

精彩评论

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