I would like to have a merge files in C#. Thx
Loading
I would like to have a merge files in C#. Thx
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sangeetha SPosted Dec 3, 2024, 5:20 AM
To merge files in C#, you can read the contents of each file and write them into a new file.
Charles HeningtonPosted Nov 30, 2024, 2:45 AM
static void MergeFiles(string[] inputFiles, string outputFile)
{
using Stream mergeStream = File.Create(outputFile);
foreach (string filename in inputFiles)
{
byte[] fileData = File.ReadAllBytes(filename);
mergeStream.Write(fileData);
}
}