My.Computer.FileSystem.WriteAllBytesなどを使用して、固定長の文字列で構成される構造をファイルに書き込みたい。
VB.Netに変換した固定長の文字列を含むVB6プロジェクトを使用しています。
Structure Record
<VBFixedString(22),System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray,SizeConst:=22)> Public tim() As Char
<VBFixedString(130),System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray,SizeConst:=130)> Public des() As Char
<VBFixedString(2),System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray,SizeConst:=2)> Public crlf() As Char
End Structure
C#でのマーシャリングはまだ新しいですが、ファイルに書き込むためにこの構造をバイト配列にするにはどうすればよいでしょうか。マーシャリングのトリックはありますか、それともカスタムメソッドを作成する必要がありますか?