我有一个短数组(short []),我需要写出一个文件.最快的方法是什么?
使用BinaryWriter
static void WriteShorts(short[] values, string path) { using (FileStream fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write)) { using (BinaryWriter bw = new BinaryWriter(fs)) { foreach (short value in values) { bw.Write(value); } } } }