比如一个文本文档里有7行数据,将它每两行或者每三行等等分成多个新的文档
using System;
using System.Collections;
using System.IO;
using System.Text;
namespace ConsoleApplication1
{
public class Program
{
//变量 TotalCountInEveryFile 表示每个新建文档里的行数
private const int TotalCountInEveryFile = 3;
static void Main(string[] args)
{
ArrayList gotStrings = GetStreamMethod("d:\\Hello.txt");
Console.WriteLine(string.Join("\n", gotStrings.ToArray()));
if (gotStrings != null)
{
int fileCount = 1;
for (int

本文档展示了如何使用C#编程将一个包含多行的文本文件拆分为多个小文件,每个新文件包含固定数量的行。通过StreamReader和StreamWriter实现文件的读写操作。
最低0.47元/天 解锁文章
488

被折叠的 条评论
为什么被折叠?



