Skip to content

Crequency/Common.BasicHelper

Repository files navigation

Common.BasicHelper Logo

Common.BasicHelper

GitHub License GitHub workflow status Nuget Nuget GitHub issues GitHub pull requests

About

Common.BasicHelper is a collection of helper functions for dotnet platform (C# mainly).

You can easily use it in your project through NuGet.

Via dotnet cli

dotnet add package Common.BasicHelper

Samples

We provide some samples in Commong.BasicHelper.Samples project.

To run this project, just run commands:

cd Common.BasicHelper.Samples
dotnet run
The output will looks like ...
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:<port>
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: <path>

<port> label is the port number of the server.

Then you can visit http://localhost:<port>/swagger/index.html to see the samples.

Usage

Math

Calculate

With Expression class and Calculator class, you can calculate your calculation. See examples of Expression class and Calculator class.

Extensions

You can use follow namespace to use extensions:

using Common.BasicHelper.Utils.Extensions;

Such as extensions in QueueHelper:

var queue = new Queue<int>()
    .Push(1)
    .Push(2)
    .Pop()
    .Push(3)
    .Push(4)
    .Pop()
    .Push(5)
    ;
queue.Dump(); // Result will be "3 4 5 "

And you can execute a string as a system command:

"help".ExecuteAsCommand();

And you can pass arguments through parameters args.

More

More extensions can be find in our docs later.

We will be appreciate if you can help us with docs site.