简体   繁体   English

将文件加载到数组中(读取所有字节)

[英]Loading a file into an array (Read all bytes)

I am currently learning to code in C#, I have made a few basic apps that just launch applications. 我目前正在学习使用C#进行编码,我已经制作了一些基本的应用程序来启动应用程序。 However now I am wanting to create a save editor. 但是现在我要创建一个保存编辑器。

I know I have to load the save into an array in order to search for the values I believe using the File.ReadAllBytes method? 我知道我必须将保存加载到数组中才能使用File.ReadAllBytes方法搜索我认为的值?

My question is how would I do this? 我的问题是我该怎么做? I know I would have to create a button on a windows form for open and another for save as well as other fields to hold information but this is as far as I know..I have done some reading on File.ReadAllBytes but I am a little confused! 我知道我必须在Windows窗体上创建一个按钮才能打开,另一个用于保存以及其他字段来保存信息,但这是据我所知..我已经对File.ReadAllBytes进行了一些阅读,但是我是有点困惑!

您可以使用File.ReadAllLines ,它将为您提供一个字符串数组,作为示例:

 string[] lines = File.ReadAllLines("yourFile.txt");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM