StaticExtensions 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package StaticExtensions --version 1.0.3                
NuGet\Install-Package StaticExtensions -Version 1.0.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StaticExtensions" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add StaticExtensions --version 1.0.3                
#r "nuget: StaticExtensions, 1.0.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install StaticExtensions as a Cake Addin
#addin nuget:?package=StaticExtensions&version=1.0.3

// Install StaticExtensions as a Cake Tool
#tool nuget:?package=StaticExtensions&version=1.0.3                

StaticExtensions

  • Extensions for all

    public static string MMCommonsFolder() { return "C:\\ProgramData\\MMCommons"; }
    public static string AppExeFolder(){ return MMConLocation() + "\\"; }
    public static string MMConLocation()  -- wrapper around Application.CommonAppDataPath backing up and adding "MMCommons";
    
    #region object exts

    public static bool IsNull(this object obj)
    public static bool AsBool(this object obj)
    public static string AsString(this object obj)
    public static int AsInt(this object obj)
    public static long AsLong(this object obj)
    public static DateTime AsDateTime(this object obj)
    public static Double AsDouble(this object obj)
    public static Decimal AsDecimal(this object obj)
    public static string AsJson(this object obj)

    #region Parse strings
    
    public static int ParseCount(this string content, string delims)
    public static string ParseString(this string content, string delims, int take)
    public static string ParseFirst(this string content, string delims)
    public static string ParseLast(this string content, string delims)
    public static string ParseReverse(this string content, string delims, string concatString)

    public static string AddQuotes(this string content) 
    public static string AddQuote(this string content)
    public static string RemoveChar(this string content, char CToRemove) 

    public static decimal AsDecimal(this string obj)
    public static string LTrim(this string content, char c) 

    #region Date to string with popular time formats. 
    
    public static string AsStrDate(this DateTime x)
    public static string AsStrDateTime12H(this DateTime x)
    public static string AsStrDateTime24H(this DateTime x)
    public static string AsStrTime(this DateTime x)
    public static string AsStrDateHHMM(this DateTime x)
    public static string AsStrDay(this DateTime x)

    #region Double

    public static Int32 AsInt32(this double x)
    public static Int32 AsInt32T(this double x)
    public static string AsStr2P(this double x)
    public static string AsStr2P(this double x, Int32 toHowManyPlaces, char paddingChar = ' ')
    public static string AsStr4P(this double x)
    public static string AsStr4P(this double x, Int32 toHowManyPlaces, char paddingChar = ' ')
    public static string AsStr8P(this double x)
    public static string AsStr8P(this double x, Int32 toHowManyPlaces, char paddingChar = ' ')
    public static decimal AsDecimal(this double x)
    public static double AsPointsVertical(this double dIn)
    public static double AsPointsHorizontal(this double dIn)

    #region Decimal
    
    public static float AsFloat(this decimal x) 
    public static int AsInt(this decimal x)
    public static int AsIntT(this decimal x)
    public static string AsStr2P(this decimal x)
    public static string AsStr2P(this decimal x, Int32 toHowManyPlaces, char paddingChar = ' ')
    public static string AsStr4P(this decimal x)
    public static string AsStr4P(this decimal x, Int32 toHowManyPlaces, char paddingChar = ' ')
    public static string AsStr8P(this decimal x)
    public static string AsStr8P(this decimal x, Int32 toHowManyPlaces, char paddingChar = ' ')
    public static double AsDouble(this decimal x)

    #region cryptish masks 
    
    // variant uses ? as fillers instead of = for base64 in inifiles.
    public static string AsBase64Encoded(this string Text)
    public static string AsBase64Decoded(this string Text)
        
    public static string AsHexStr(this byte[] byteArray) 
    public static byte[] AsByteArray(this string hexString)
    public static string AsFiletoMD5(string filePath) 

    #region exceptions
    
    public static string AsWalkExcTreePath(this Exception e)   
    public static Exception WriteAppLog(this Exception e, string messageString)
    public static void WriteToAppLog(this string messageString)
    public static string WriteToTextFile(this string stringToWrite, string logFileName)
    public static string WriteToTextFileLine(this string stringToWrite, string logFileName)
    public static Exception WriteToLogException(this Exception e, string logFileNamePart)

    #region Images

    public static Regex r = new Regex(":");
    
    //retrieves the datetime WITHOUT loading the whole image
    public static DateTime GetDateTakenFromImage(this string path) 

    // GetColors by Matt Meents, creates const foreach ARGB and then sum out the colors...
    public static Color[] GetColors(Color fromColor, Color toColor, int howMany)

    #endregion
Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on StaticExtensions:

Package Downloads
AppCrypto

Reusable Helpers and Cuncurrent Dictionaries and IniFile

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.3 305 12/24/2022
2.0.2 529 11/27/2022
2.0.1 392 11/20/2022
2.0.0 75 11/19/2022
1.0.3 360 11/13/2022
1.0.2 349 11/12/2022
1.0.0 424 11/11/2022

Initial Release.