Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

ellerbus/Augment

Repository files navigation

Augment

.NET Object Extension Library (formerly NOX) - renamed from NOX since there were several overlapping projects of various areas using NOX as a codename.

What is Augment? By definition augment means to make (something) greater by adding to it. While .NET has an abundance of libraries that make coding fantastic, I found myself reusing and copying several extension files from project to project. So I decided to place them into a common library and share with anyone who is interested. This is a small collection of common code I've collected over the years from various sources (some known, others unfortunately forgotten).

See the WIKI for more details (otherwise check out the code itself)

Samples

DateTime, TimeSpan Extensions

DateTime.Now.BeginningOfDay()		// Week, Month, Year, Quarter
DateTime.Now.EndOfDay()				// Week, Month, Year, Quarter

DateTime.Now.IsBusinessDay()
DateTime.Now.IsHoliday()
DateTime.Now.IsWeekend()

DateTime.Now.ToRelativeDateString()	//	3 seconds ago or 3 seconds from now

3.Seconds()							//	returns TimeSpan
3.Seconds().Ago()					//	returns DateTime

6.Months().FromNow()

Enum Extensions

enum MyEnum
{
  Pass,
  [System.ComponentModel.Description("Failed")]
  Fail
}

string e = MyEnum.Pass.ToDescription();

if (e.ToEnum<MyEnum> == MyEnum.Fail) // etc.

Int, Double Extensions

3.25.PercentOf(125.548)

25.PercentOf(20000)

String, StringBuilder Extensions

string text = "123abc";

text = text.GetLeftOf("abc");

StringBuilder sb = new StringBuilder(text);

sb.AppendIf(text.Contains("abc"), "def" /*true*/, "456" /*false*/);
// or
sb.AppendIf(text.Contains("abc"), "def");

string so = null;

if (so.IsNullOrEmtpy()) so = "what!";

string d = so.AssertNotNull("abc");

NOTES

https://github.com/xin9le/DeclarativeSql https://github.com/jonwagner/Insight.Database.Schema

About

Library of .NET Extensions and Helpers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages