- Most notable is the .Save() and .Load() methods added to the System.Object class. This allows any object to be serialized to and from disk very rapidly e.g.:
(object)MyClass.Save(<FilePath>);
and
(MyClassDefinition)MyClass = (object)MyClass.Load(<FilePath>); - A series of extensions was added to the System.Double class allowing any number cast as a double to be quickly converted between binary data sizes e.g.:
double SizeInTB = 2;
double SizeInKB = SizeInTB.ToKB(Constants.NumberByte.TB);
Which will return 2,147,483,648 i.e. the number of KB in 2 TB. - A series of extensions was added to both the System.String and Sytem.Text.StringBuilder classes that make it easy to validate strong passwords e.g.:
string MyPassword = Console.Readline();
if (MyPassword.IsStrong())
{
//Pass. Input is a strong password.
}
else
{
//Fail. Input is NOT a strong password.
}
Even better is if you want to exclude say symbols or special characters requiring users to only use upper case, lower case and numbers, you can override the default parameters e.g.:
if (MyPassword.IsStrong(true, true, true, false))
The component methods of .IsStrong() can also be used independently e.g.
MyPassword.HasUpper()
MyPassword.HasLower()
MyPassword.HasNumeric()
MyPassword.HasSymbol() - A series of extensions was added to both the System.String and Sytem.Text.StringBuilder classes that make it easy to validate if a string is a valid US Zip code e.g.:
MyString.IsZipCode()
The method handles both 5 digit and 9 digit zip codes. - Extension methods was also added to make other string based operations easier e.g.
MyString.IsLower()
MyString.IsUpper() - Extension methods from previous versions were enhanced by adding the option to ignore white space as part of these methods:
MyString.IsAlphabetic()
MyString.IsAlphaNumeric()
MyString.IsNumeric() - On the lighter side of things, if you've ever wondered what it was like to live in the Morse Code era, you can leverage to silly methods to see for yourself like this:
"My message I want to send".ToMorseCode().MorseCodeBeep();
For a more detail of what Extensions offer, see:
README page on GitHub - https://github.com/cjvandyk/Quix/blob/master/Extensions/README.md
NuGet as Extensions.cs - https://www.nuget.org/packages/Extensions.cs/2.0.1
GitHub Source - https://github.com/cjvandyk/Quix/blob/master/Extensions
Suggestions and bugs - https://github.com/cjvandyk/Quix/discussions
Add Extensions to your toolbox and make your coding life a little easier.
Happy coding
C
No comments:
Post a Comment
Comments are moderated only for the purpose of keeping pesky spammers at bay.