Extensions.cs 1.1.28

.NET Framework 4.8
There is a newer version of this package available.
See the version list below for details.
Install-Package Extensions.cs -Version 1.1.28
dotnet add package Extensions.cs --version 1.1.28
<PackageReference Include="Extensions.cs" Version="1.1.28" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Extensions.cs --version 1.1.28
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Extensions.cs, 1.1.28"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Extensions.cs as a Cake Addin
#addin nuget:?package=Extensions.cs&version=1.1.28

// Install Extensions.cs as a Cake Tool
#tool nuget:?package=Extensions.cs&version=1.1.28
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Extensions.dll contains extension methods that enhance existing C# classes thus making life easier for developers.

Product Versions
.NET Framework net48
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.2.500 826 3/5/2021
3.1.500 162 2/26/2021
3.0.500 159 2/19/2021
2.3.500 140 2/12/2021
2.2.480 179 2/5/2021
2.1.480 151 2/1/2021
2.0.1 202 1/22/2021
1.1.28 164 1/15/2021
1.0.1 225 1/8/2021

Elevate()
     Restarts the current process with elevated permissions.
     For example:
     System.Diagnostics.Process.GetCurrentProcess().Elevate(args)
     will restart the current console app in admin mode.

     Get()
     Language extension for properties.  Use to get the value of the
     extension property in question.

     GetUrlRoot()
     Get the URL root for the given string object containing a URL.
     For example:
     "https://blog.cjvandyk.com/".GetUrlRoot()
     will return
     "https://blog.cjvandyk.com/"
     whereas
     "https://blog.cjvandyk.com/sites/Approval".GetUrlRoot()
     will also return
     "https://blog.cjvandyk.com/".

     IsAlphabetic()
     Validates that the given string object contains all alphabetic
     characters (a-z and A-Z) returning True if it does and False if
     it doesn't.
     For example:
     "abcXYZ".IsAlphabetic()
     will return True whereas
     "abc123".IsAlphabetic()
     will return False.

     IsNumeric()
     Validates that the given string object contains all numeric
     characters (0-9) returning True if it does and False  if it
     doesn't.
     For example:
     "123456".IsNumeric()
     will return True whereas
     "abc123".IsNumeric()
     will return False.

     IsAlphaNumeric()
     Validates that the given string object contains all alphabetic
     and/or numeric characters (a-z and A-Z and 0-9) returning True if it
     does and False  if it doesn't.
     For example:
     "abc123".IsAlphaNumeric()
     will return True whereas
     "abcxyz".IsAlphaNumeric()
     will also return True and
     "123456".IsAlphaNumeric()
     will also return True but
     "abc!@#".IsAlphaNumeric()
     will return False.

     IsChar()
     This method takes a char[] as one of its arguments against which the
     given string object is validated.  If the given string object contains
     only characters found in the char[] it will return True, otherwise it
     will return False.
     For example:
     "aacc".IsChar(new char[] {'a', 'c'})
     will return True whereas
     "abc123".IsNumeric()
     will return False.

     IsUrlRoot()
     Check if the given string object containing a URL, is that of the
     URL root only.  Returns True if so, False if not.  For example:
     "https://blog.cjvandyk.com/".IsUrlRootOnly()
     will return True whereas
     "https://blog.cjvandyk.com/sites/Approval".IsUrlRootOnly()
     will return False.

     Lines()
     This method returns the number of lines/sentences in the given string
     object.

     LoremIpsum()
     Poplates the given string with a given number of paragraphs of dummy
     text in the lorem ipsum style e.g.
     "".LoremIpsum(2)
     would yield
     "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer
     aliquam arcu rhoncus erat consectetur, quis rutrum augue tincidunt.
     Suspendisse elit ipsum, lobortis lobortis tellus eu, vulputate
     fringilla lorem. Cras molestie nibh sed turpis dapibus sollicitudin
     ut a nulla. Suspendisse blandit suscipit egestas. Nunc et ante mattis
     nulla vehicula rhoncus. Vivamus commodo nunc id ultricies accumsan.
     Mauris vitae ante ut justo venenatis tempus.

     Nunc posuere, nisi eu convallis convallis, quam urna sagittis ipsum,
     et tempor ante libero ac ex. Aenean lacus mi, blandit non eros luctus,
     ultrices consectetur nunc. Vivamus suscipit justo odio, a porta massa
     posuere ac. Aenean varius leo non ipsum porttitor eleifend. Phasellus
     accumsan ultrices massa et finibus. Nunc vestibulum augue ut bibendum
     facilisis. Donec est massa, lobortis quis molestie at, placerat a
     neque. Donec quis bibendum leo. Pellentesque ultricies ac odio id
     pharetra. Nulla enim massa, lacinia nec nunc nec, egestas pulvinar
     odio. Sed pulvinar molestie justo, eu hendrerit nunc blandit eu.
     Suspendisse et sapien quis ipsum scelerisque rutrum."

     ReplaceTokens()
     Takes a given string object and replaces 1 to n tokens in the string
     with replacement tokens as defined in the given Dictionary of strings.

     Retry()
     Checks if a System.Net.WebException contains a "Retry-After" header.
     If it does, it sleeps the thread for that period (+ 60 seconds)
     before reattempting to HTTP call that caused the exception in the
     first place.  If no "Retry-After" header exist, the exception is
     simply rethrown.
     For example:
     System.Net.HttpWebRequest request ...
     Try
     {
     request.GetResponse();
     }
     Catch (System.Net.WebException ex)
     {
     ex.Retry(request);
     }

     Set()
     Language extension for properties.  Use to set the value of the
     extension property in question.

     ToBinary()
     This method returns the given string represented in 1s and 0s as
     a binary result.
     For example:
     "This test".ToBinary()
     will return
     1010100 1101000 1101001 1110011 100000 1110100 1100101 1110011 1110100

     Words()
     This method returns the number of words used in the given string
     object.
     For example:
     "This is my test".Words()
     will return 4 whereas
     "ThisIsMyTest".Words()
     will return 1.