Append chars to SecureString : SecureString « Security « C# / C Sharp






Append chars to SecureString

 

using System;
using System.Security;

public class Example
{
   public static void Main()
   {
      char[] chars = { 't', 'e', 's', 't' };
      // Instantiate the secure string.
      SecureString testString = new SecureString();
      // Assign the character array to the secure string.
      foreach (char ch in chars)
         testString.AppendChar(ch);      
      // Display secure string length.
      Console.WriteLine("The length of the string is {0} characters.", testString.Length);

   }
}

   
  








Related examples in the same category

1.MakeReadOnly, RemoveAt
2.Create SecureString