Skip to content

Latest commit

 

History

History
59 lines (49 loc) · 1.94 KB

File metadata and controls

59 lines (49 loc) · 1.94 KB

Utility

NuGet GitHub release (latest by date) GitHub

Table of content

Description

A set of utilities to simplify development that do not fit into a separate assembly and have the ability to general use.

Install

For use you needed install packages:

Install-Package Skidbladnir.Utility.Common

Implementation

  1. Retry - retry policy implementation
    Sample:
    var result = Retry.Do( () => DoSomething(), retryCount: 3, delay: TimeSpan.FromSeconds(1));
  2. Try - The class contains methods that allow you to perform operations with the ability to handle errors
    Sample:
    var result = await Try.DoAsync(() => DoSomething());
  3. Pluarization - Attempts to pluralize the specified text according to the rules of the English language.
    Sample:
     var text = "Index";
     Console.WriteLine(text.Plural()); //Writes: Indexes
  4. StreamExtentions - The class contains methods for reading streams to memory
    Sample:
    var streamBytes = fileStream.ReadAllBytes();
  5. ObjectExtensions - The class contains common methods for objects. At now only implement DeepClone method. Sample:
    var a = new MyObject();
    var cloneA = a.DeepClone();
  6. Requires - A static helper class that includes various parameter checking routines. Sample:
    string test = "not empty string";
    test.StringNotNullOrEmpty(); // pass without exception
    MyObject a = null;
    a.ObjectNotNull(); // Throw exception with text `Object can't be null`