title: How to use unsafe code in safe contex?
body: <p>I need to use <code>SecureString</code> for a Microsoft's class and i found the following code on the <a href="http://blogs.msdn.com/b/fpintos/archive/2009/06/12/how-to-properly-convert-securestring-to-string.aspx">internet</a>:</p>
  
  <pre><code>public static class SecureStringExt
  {
      public static SecureString ConvertToSecureString(this string password)
      {
          if (password == null)
              throw new ArgumentNullException("password");
  
          unsafe //Red highlighted line
          {
              fixed (char* passwordChars = password)
              {
                  var securePassword = new SecureString(passwordChars, password.Length);
                  securePassword.MakeReadOnly();
                  return securePassword;
              }
          }
      }
  }
  </code></pre>
  
  <p>The only problem is that the <code>unsafe</code> keyword keeps throwing me error saying <code>Cannot use unsafe construct in safe context</code>.
  Unfortunately i couldn't find why is this happening... </p>
  
  <p><strong>Note:</strong>
  The above code runs in LINQPad but not in VS2013 (with resharper).</p>