devel0 / netcore-util

net core util

Home Page:https://devel0.github.io/netcore-util/api/SearchAThing.Util.html

Repository from Github https://github.comdevel0/netcore-utilRepository from Github https://github.comdevel0/netcore-util

netcore-util

NuGet Badge

.NET core utilities



Quickstart

dotnet new console --use-program-main -n test
cd test
dotnet add package netcore-util
dotnet run
using SearchAThing.Util;
using static SearchAThing.Util.Toolkit;

Unit tests

dotnet test
  • to debug from vscode just run debug test from code lens balloon

Examples

exec-bash-redirect

namespace SearchAThing.Util.Examples;

class Program
{
    static void Main(string[] args)
    {
        Task.Run(async () =>
        {
            var q = await ExecBashRedirect("i=0; while (($i < 5)); do echo $i; let i=$i+1; done",
                CancellationToken.None,
                sudo: false,
                verbose: false);

            if (q.ExitCode == 0)
            {
                System.Console.WriteLine($"output[{q.Output}]");
            }

            // RESULT:
            //
            // output[0
            // 1
            // 2
            // 3
            // 4

            // ]

        }).Wait();
    }
}

How this project was built

mkdir netcore-util
cd netcore-util

dotnet new sln

mkdir -p examples src/util

cd src/util
dotnet new classlib -n netcore-util
# add packages ( https://nuget.org )

cd ..
dotnet new xunit -n test
cd test
dotnet add reference ../util/netcore-util.csproj
cd ..

dotnet sln add src/util src/test examples/example01
dotnet build
dotnet test

About

net core util

https://devel0.github.io/netcore-util/api/SearchAThing.Util.html

License:MIT License


Languages

Language:C# 91.0%Language:Shell 9.0%