Giter Club home page Giter Club logo

navyblue.baselibrary's Introduction

Navyblue.BaseLibrary

A library for basic usage, like ToJson, FromJson<> and other extensions for int, long, DateTime, Byte, Dictionary, Enum, Guid, MD5 and soon.

This library has been used by many project and running in production for a long time, so it is very stable.

Also, it is not just a extension tool, but also aims to make your code is more like OOP pattern.

Install

nuget install Navyblue.BaseLibrary

Samples (string)

  • Convert Json Format String to Object
T obj = jsonString.FromJson<T>();
  • Convert Object to Json Format String
string jsonString = obj.ToJson();
  • IsNullOrEmpty
if(str.IsNullOrEmpty())
{
    // your code
}

Samples (int)

  • IsBetween
3.IsBetween(2, 5);// return true
  • Loop
3.Times().Do(p =>
{
  Console.WriteLine("Hello world");
});

Samples (GUID)

Guid.NewGuid().ToGuidString();
"XXXXXXXXXXXXXXXXXXXXX".ToGuid()
//Creates a sequential GUID according to SQL Server's ordering rules.
GuidUtility.NewSequentialGuid()

Samples (MD5)

MD5Hash.ComputeMD5Hash("111111111"); // return byte[]
MD5Hash.ComputeMD5HashString("111111111"); return string 

Samples (Byte)

byteObj.ASCII();
byteObj.GetBytesOfASCII();
byteObj.Unicode();
byteObj.GetBytesOfUnicode();
byteObj.Utf8();
byteObj.GetBytesOfUTF8();
......

Samples (DateTime)

dateTimeObj.DurationToNow();
dateTimeObj.IsAfter(destination);
dateTimeObj.IsAfterOrEqual(destination);
dateTimeObj.IsBefore(destination);
dateTimeObj.IsBefore(destination);
......

Samples (IEnumerable)

iEnumerableObj.ForEach(Action);
iEnumerableObj.GetLength();
iEnumerableObj.GetPage();
iEnumerableObj.IsNotNullOrEmpty();
iEnumerableObj.Join(destination);
iEnumerableObj.IsEnumerableEmpty();
iEnumerableObj.IsSequenceNullOrEmpty();
......

Also, there are many other extension functions for you. Last but note least, please give me a star, many thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.