C# padding string with n bytes and writing it out
<p>I'm writing out data using <code>BinaryWriter</code>.<br>
Now I'm writing out a string that will be padded to 256 bytes, with null bytes to make up for the leftover space (eg: string "hello world" takes up 11 bytes, so I will need to write another 245 null bytes).</p>

<p>The current approach is to just write out the string normally, calculate the length of the string and subtract that from 256 to get the desired number of null bytes, and then use a for loop to write out all of those nulls.</p>

<p>But maybe it's better to first build my null-padded string and then write it out all at once. How can I pad my string with null bytes to a length of n?</p>

<p>I guess they would be null chars rather than null bytes.</p>
