An open API service indexing awesome lists of open source software.

https://github.com/crequency/common.basichelper

Basic utils for all C# projects
https://github.com/crequency/common.basichelper

core dotnet general-library library

Last synced: 12 months ago
JSON representation

Basic utils for all C# projects

Awesome Lists containing this project

README

          



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

```shell
dotnet add package Common.BasicHelper
```

# Samples

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

To run this project, just run commands:

```shell
cd Common.BasicHelper.Samples
dotnet run
```

The output will looks like ...


```plaintext
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:
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:
```

`` label is the port number of the server.

Then you can visit `http://localhost:/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](./Common.BasicHelper.Test/Math/Expression_Tests.cs) class and [Calculator](./Common.BasicHelper.Test/Math/Calculator_Tests.cs) class.

## Extensions

You can use follow namespace to use extensions:

```CSharp
using Common.BasicHelper.Utils.Extensions;
```

Such as extensions in `QueueHelper`:

```CSharp
var queue = new Queue()
.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:

```CSharp
"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.