Skip to content

Instantly share code, notes, and snippets.

View tomschrot's full-sized avatar
💭
It is not working!

Tom Schröter tomschrot

💭
It is not working!
View GitHub Profile
@tomschrot
tomschrot / Program.cs
Created February 14, 2024 13:06
Respnse to "The Awesome New LINQ Methods Coming in .NET 9!"
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
char[] SEPARATORS = [',', '.',';','!','?',' ','\n', '\r'];
WriteLine ("Hello Everybody!");
@tomschrot
tomschrot / MessageBus.cs
Last active January 13, 2024 09:21
MessageBus
public sealed class MessageBus
{
//-------------------------------------------------------------------------
private readonly Dictionary <string, object> _bus = new ();
//-------------------------------------------------------------------------
/// <summary>
/// Subscribes a receiver to a channel in the message bus.
@tomschrot
tomschrot / Configuration.cs
Last active October 10, 2023 06:47
Configuration class with Load/Save as JSON
using System;
using System.Text.Json;
using System.IO;
using System.Text;
public sealed class Configuration
{
//-------------------------------------------------------------------------
@tomschrot
tomschrot / Program.cs
Last active July 27, 2023 08:24
CitationSegment formating using functional OneOf-Pattern
/*
Functional approach using OneOf-pattern
(Discriminated Unions)
for example
https://www.youtube.com/watch?v=exsfSEDeyF4&t=715s
(c) Thomas Schröter / github: tomschrot
*/
@tomschrot
tomschrot / Option.cs
Last active May 10, 2023 13:28
C# Option Monad
using System;
// namespace
#nullable enable
public sealed class Option <T>
where T: class
{
//-------------------------------------------------------------------------
@tomschrot
tomschrot / Text.md
Last active October 10, 2025 09:12
scrap

"C#".Aspects();

Extensions ab .NET 10 und C# 14

Installation des .NET 10 Preview SDK unter Linux (Ubuntu, Mint...)

  1. Download der gewünschten Preview Version: z.B. https://dotnet.microsoft.com/en-us/download/dotnet/10.0
  2. Entpacken des Archivs in den Dotnet-Ordner, z.B. $HOME/.dotnet
@tomschrot
tomschrot / Program.cs
Created December 20, 2022 10:27
C# Wahrscheinlichkeit 6 aus 49
using System.Collections.Generic;
using System.Text;
using System;
using myLibrary.Infrastructure.Extensions;
Console.WriteLine ("Console Application Template for VS Code\nby Tom Schröter");
var c = AoutB (6, 49);
@tomschrot
tomschrot / Program.cs
Last active December 18, 2022 12:20
C# operator overload via wrapper class
using System.Collections.Generic;
using System.Text;
using System;
using myLibrary.Infrastructure.Extensions;
Console.WriteLine ("Console Application Template for VS Code\nby Tom Schröter");
string name = "Donald";
@tomschrot
tomschrot / CurryDatabase.cs
Last active October 8, 2022 10:08
CurryDatabase
public class Database: IDisposable
{
public static fnOpen? begin(string dbProvider) => new Database().Open;
public delegate fnResume? fnOpen (string connection);
public delegate fnQuery? fnResume (Action<string> onError);
public delegate fnResume? fnQuery (string query, Action onResult = null);
public fnQuery? Resume (Action<string> onError)
{
@tomschrot
tomschrot / Container.cs
Last active June 21, 2022 08:33
Property Reflection
namespace Infrastructure.DPInject;
public sealed class Container
{
private readonly Dictionary <string, dynamic> _items = new ();
internal Container () {}
public dynamic this [string name]