If all you're trying to do is replace & with & then you don't need to read the whole file at once.
You only need to read in manageable blocks.
The following code I haven't tested but should give you the gist of what you need to do to limit the impact of working with large files.
Once working have a play with the block size and bench mark performance so you can achieve your result in the best time.
string inputFile = "myFile.xml";
string tempFile = "tmp.xml";
System.IO.FileStream input = System.IO.File.OpenRead(inputFile);
System.IO.FileStream output = System.IO.File.Open(tempFile, System.IO.FileMode.Create, System.IO.FileAccess.Write);
long position = 0;
long blockSize = 200;
long fileSize = input.Length;
long outputPosition = 0;
byte[] buffer = new byte[blockSize];
bool atEnd = false;
while(!atEnd)
{
long currentBlock = blockSize;
if (position + blockSize > fileSize)
currentBlock = fileSize - position;
input.Read(buffer, (int)position, (int)currentBlock);
byte[] outputBuffer = System.Text.Encoding.UTF8.GetBytes(System.Text.Encoding.UTF8.GetString(buffer).Replace("&", "&"));
output.Write(outputBuffer, (int)outputPosition, outputBuffer.Length);
if (position >= fileSize) {
atEnd = true;
} else {
outputPosition += outputBuffer.Length;
position += currentBlock;
}
}
input.Close();
output.Close();
System.IO.File.Delete(inputFile);
System.IO.File.Move(tempFile, inputFile);