C# equivalent for PHP file_put_contents
<p>I am converting a PHP file to C#,completed 75%,stuck with these lines
</p>

<pre><code>if(file_put_contents($uploaddir.$randomName, $decodedData)) {
    //echo $randomName.":uploaded successfully"; //NO NEED TO CONVERT ECHO PART
}
</code></pre>

<p>PHP Brothers please help</p>

<p><strong>MORE INFO</strong></p>

<p>I converted <strong><em>this</em></strong></p>

<pre><code>// Encode it correctly
$encodedData = str_replace(' ','+',$data[1]);
$decodedData = base64_decode($encodedData);
</code></pre>

<p><em><strong>to this</em></strong></p>

<pre><code>// Encode it correctly
string encodedData = data[1].Replace(' ', '+');
string decodedData = base64Decode(encodedData);
</code></pre>

<p>where base64Decode <strong><em>is</em></strong>
</p>

<pre><code>public static string base64Decode(string data)
{
    byte[] binary = Convert.FromBase64String(data);
    return Encoding.Default.GetString(binary);
}
</code></pre>
