MMDHelpers.CSharp.PerformanceChecks 1.0.3

dotnet add package MMDHelpers.CSharp.PerformanceChecks --version 1.0.3
NuGet\Install-Package MMDHelpers.CSharp.PerformanceChecks -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MMDHelpers.CSharp.PerformanceChecks" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MMDHelpers.CSharp.PerformanceChecks --version 1.0.3
#r "nuget: MMDHelpers.CSharp.PerformanceChecks, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MMDHelpers.CSharp.PerformanceChecks as a Cake Addin
#addin nuget:?package=MMDHelpers.CSharp.PerformanceChecks&version=1.0.3

// Install MMDHelpers.CSharp.PerformanceChecks as a Cake Tool
#tool nuget:?package=MMDHelpers.CSharp.PerformanceChecks&version=1.0.3

MMDHelpers.CSharp

This project is a collection of helpers that i've been using across multiple projects

Feedbacks are always welcome 😄

Some of the code are production ready, and some are just experimentations

Projects and purpose

  • [Nuget] MMDHelpers.CSharp - simple helpers, you should avoid those if your application need to be high performance GC is not verified.
  • [Nuget] MMDHelpers.CSharp.LDAP - simple abstraction to login on a LDAP service.
  • [Nuget] MMDHelpers.CSharp.LocalData - generates a localDB, uses dapper as micro-orm.
  • [Nuget] MMDHelpers.CSharp.Performance.Grpc - An example to use Grpc to measure Performance (not ideally, but just enough to get the evident ones)
  • MMDHelpers.CSharp.Performance.GrpcClient - A client to control the server.
  • [Nuget] MMDHelpers.CSharp.PerformanceChecks - Just shows the GC Collection and workingSet being used.

MMDHelpers.CSharp

WriteToFile

As i mentioned before, there are better solutions like Log4net, Serilog, NLog but for small projects or just to Test this is enough.

        ////An Example on Application
        public static void Write(string filename, params string[] texts)
        {
            if (texts.Length == 0) return;
            lock (sync)
            {
                filename
                    .ToCurrentPath()
                    .WriteToFile(new List<string>(texts.Length) { string.Join("", texts.Select(c => $"{DateTime.Now} - {c} {Environment.NewLine}")) });
            }
        }
        
        ////Usage:
        Write("somefile.log","test 1", "test 2");
AsDataTable

As the Example Above this will be enough when your collection is small around 10-150k. beware it'll have overhead, as internally i'm using reflection to get types.

public void SomeMethodToBulkInsert<T>(IEnumerable<T> somelist )
using (var conn = new SqlConnection("someconn"))
{
    conn.Open();
    var transaction = conn.BeginTransaction();
    using (var bulkCopy = new SqlBulkCopy(conn, SqlBulkCopyOptions.Default, transaction))
    {
        bulkCopy.BatchSize = 500;
        bulkCopy.DestinationTableName = "dbo.someTable";
        try
        {
            SqlBulkCopyColumnMapping someColumn = new SqlBulkCopyColumnMapping("source", "destination");
            
            bulkCopy.ColumnMappings.Add(someColumn);
            
            bulkCopy.WriteToServer(somelist.Select(q => new { q.someColumn }).AsDataTable());
            transaction.Commit();
        }
        catch (Exception ex)
        {
            transaction.Rollback();
        }
    }
}

MMDHelpers.CSharp.PerformanceChecks

If you need high performant tools to analyze your code, i recommend my Book of Reference. there i'm collecting Articles, tools to those scenarios.

    Ruler.StartMeasuring(false);
    Ruler.StopMeasuring(false);
    Ruler.Show(true);
    Ruler.LogToFile();
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MMDHelpers.CSharp.PerformanceChecks:

Package Downloads
MMDHelpers.CSharp.Performance.Grpc

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 480 2/28/2021
1.0.2 408 2/28/2021
1.0.1 345 2/27/2021
1.0.0 376 2/26/2021