How to convert a Securestring to String using C# and VB.NET

Here is an example on how to convert a Securestring to String using C# and VB.NET.
Please remember that storing the data in a plain string will be beat the whole point of using SecureString. This method should only be used for testing purposes.
This Extension Method is now part of the Fesslersoft.Extensions.

Samples

C# Sample

VB.NET Sample

If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

Please rate this snippet

How to convert a String to Securestring using C# and VB.NET

Here is an example on how to convert a String to Securestring using C# and VB.NET.
Please remember that the plain string which will be converted to SecureString beats the whole point of using SecureString. This method should only be used for testing purposes.
This Extension Method is now part of the Fesslersoft.Extensions.

Samples

C# Sample

VB.NET Sample

If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

Please rate this snippet

What is the difference between mutable and immutable in C# and VB.NET

What is the difference between a mutable and immutable string in C# and VB.NET?

  • A mutable string can be changed.
  • An immutable string cannot be changed.
  • Mutable is the english word for can change. Immutable is the english word for cannot change.

    if you alter a String, you are creating a new string object internally. So String is immutable. If you alter a StringBuilder no new Objects are created internally so, StringBuilder is mutable.

    Please rate this snippet