Initialize the text value of an instance of the System.Security.SecureString class with the erload:System.Security.SecureString.#ctor constructors, and modify the value with the SecureString.Clear, SecureString.RemoveAt(int), SecureString.SetAt(int, char), SecureString.InsertAt(int, char), and SecureString.AppendChar(char) methods.
After you have made your final modifications, use the SecureString.MakeReadOnly method to make the value of the instance immutable (read-only). After the value is marked as read-only, any further attempt to modify it throws an InvalidOperationException.
The effect of invoking SecureString.MakeReadOnly is permanent because no means is provided to make the secure string modifiable again. Use the SecureString.IsReadOnly method to test whether an instance of System.Security.SecureString is read-only.