我需要创建一个方法来生成二进制文件(4 字节长),接收整数列表并将该列表一一写入文件中。所以,我有这个:
public void FrameCodesBinaryWriter(List<int> frameCodes)
{
using (FileStream fileStream = new FileStream(binaryFilePath, FileMode.Create)) // destiny file directory.
{
using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
{
for (int i = 0; i < frameCodes.Count; i++)
{
binaryWriter.Write(frameCodes[i]);
}
binaryWriter.Close();
}
}
}
这个对吗?或其他一些解决方案,请