Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are some string encapsulation classes which specify both meaning and behavior for their contents?

Tags:

.net

.NET has System.Uri for Uris and System.IO.FileInfo for file paths. I am looking for classes which are traditionally object oriented in that they specify both meaning and behavior for the string which is used in the object's construction. What other useful string encapsulation classes exist?

Things such as regular expressions and StringBuilders are useful for the gross manipulation of strings but they aren't what I'm looking for.

like image 377
Rick Minerich Avatar asked Dec 14 '22 06:12

Rick Minerich


1 Answers

Maybe System.Security.SecureString for strings which you do not want to be available in public memory.

using (System.Security.SecureString password = new System.Security.SecureString())
{
    password.AppendChar('s');
    password.AppendChar('e');
    password.AppendChar('c');
    password.AppendChar('r');
    password.AppendChar('e');
    password.AppendChar('t');
    password.MakeReadOnly();
}
like image 86
hangy Avatar answered May 26 '23 12:05

hangy