25 January 2021

Extensions 2.0.1 Major version update released!

On Friday morning a major version update of Extensions was released.  The new version brings with it a TON of new extension methods for C# such as:

  1. 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>);

  2. 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.

  3. 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()


  4. 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.

  5. Extension methods was also added to make other string based operations easier e.g.

    MyString.IsLower()
    MyString.IsUpper()

  6. 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()

  7. 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:







Add Extensions to your toolbox and make your coding life a little easier.  

Happy coding
C

18 January 2021

Extensions enhancement - RemoveExtraSpace() method added

The .RemoveExtraSpace() method was added to both the System.String and System.Text.StringBuilder objects.  It allows the quick removal of extra space in the entire string.  It will remove all leading as well as trailing white space in addition to ensuring that only single space is used throughout the string e.g.

"    string truth = \"https://blog.cjvandyk.com   ROCKS !!!   \"".RemoveExtraSpace()

will return

"string truth = \"https://blog.cjvandyk.com ROCKS !!! \""


For a more detail of what Extensions offer, see:







Add Extensions to your toolbox and make your coding life a little easier.  

Happy coding
C

11 January 2021

Extensions enhancement - IsVowel() method added

The .IsVowel() method was added to the System.Char, System.String and System.Text.StringBuilder objects.  It allows the developer the ability to check a substring for a vowel e.g.

"https://blog.cjvandyk.com ROCKS!!!".SubString(10, 1).IsVowel()

will return True because it's checking the "o" while

"https://blog.cjvandyk.com ROCKS!!!".SubString(11, 1).IsVowel()

will return False since it's checking the "g".


For a more detail of what Extensions offer, see:







Add Extensions to your toolbox and make your coding life a little easier.  

Happy coding
C

04 January 2021

Extensions enhancement - IsZipCode() method added

The .IsZipCode() method was added to both the System.String and System.Text.StringBuilder objects.  It allows the developer the ability to quickly check if a string is in valid US zip code format e.g.

"12345".IsZipCode()

will return True as will

"12345-6789".IsZipCode()

but this

"12345678".IsZipCode()

Will return False.


For a more detail of what Extensions offer, see:







Add Extensions to your toolbox and make your coding life a little easier.  

Happy coding
C

SharePoint Remote Event Receivers are DEAD!!!

 Well, the time has finally come.  It was evident when Microsoft started pushing everyone to WebHooks, but this FAQ and related announcement...