ToSecureString

/// <summary>
/// Converts a string into a "SecureString"
/// </summary>
/// <param name="str">Input String</param>
/// <returns></returns>
public static System.Security.SecureString ToSecureString(this String str)
{
    System.Security.SecureString secureString = new System.Security.SecureString();
    foreach (Char c in str)
        secureString.AppendChar(c);

    return secureString;
}
Example:
String password = "mypassword";
System.Security.SecureString secure = password.ToSecureString();

Description

Converts a string into a "SecureString"

Details

Double click on the code to select all.

 

;