I’ve a simple method to write bytes to a file on an SD card:
public void WriteBytes(string filename, byte[] bytes, int offset = 0, int count = -1, FileMode mode = FileMode.Create)
{
count = (count >= 0) ? count : bytes.Length;
using (var fs = File.Open(GetPath(filename), mode, FileAccess.Write))
{
fs.Write(bytes, offset, count);
fs.Flush();
}
Debug.GC(true);
}
Because I have very little memory to play with I’ve added a forced garbage collection to the write method. Am I correct in thinking that this method only works in ‘debug’ and not in ‘release’?