What is the equivalent of memset in C#?
<p>I need to fill a <code>byte[]</code> with a single <strong>non-zero</strong> value. How can I do this in C# without looping through each <code>byte</code> in the array?</p>

<p><strong>Update:</strong> The comments seem to have split this into two questions -</p>

<ol>
<li>Is there a Framework method to fill a byte[] that might be akin to <code>memset</code></li>
<li>What is the most efficient way to do it when we are dealing with a very large array?</li>
</ol>

<p>I totally agree that using a simple loop works just fine, as Eric and others have pointed out. The point of the question was to see if I could learn something new about C# :) I think Juliet's method for a Parallel operation should be even faster than a simple loop.</p>

<p><strong>Benchmarks:</strong>
Thanks to Mikael Svenson: <a href="http://techmikael.blogspot.com/2009/12/filling-array-with-default-value.html">http://techmikael.blogspot.com/2009/12/filling-array-with-default-value.html</a></p>

<p>It turns out the simple <code>for</code> loop is the way to go unless you want to use unsafe code.</p>

<p>Apologies for not being clearer in my original post. Eric and Mark are both correct in their comments; need to have more focused questions for sure. Thanks for everyone's suggestions and responses.</p>
