How can I convert this method from C++ to C#?
<p>Could someone explain how I'd write this to C#?</p>

<pre><code>//byte[] buffer is priavte in the class
//it's for writing Packets (gameserver)
void writeString(int location, std::string value, int length) {
    if (value.length() &lt; length) {
        memcpy(&amp;buffer[location], value.c_str(), value.length());
        memset(&amp;buffer[location+value.length()], 0, length-value.length());
    }
    else memcpy(&amp;buffer[location], value.c_str(), length);
}
</code></pre>
