Skip to content

Instantly share code, notes, and snippets.

View ycherkes's full-sized avatar
🇺🇦
#armukraineasap 🇳🇴

Yevhen Cherkes ycherkes

🇺🇦
#armukraineasap 🇳🇴
View GitHub Profile
@ycherkes
ycherkes / Compare-Net-Objects-Issue.cs
Created April 11, 2024 12:55
Compare-Net-Objects issue
CompareLogic compareLogic = new CompareLogic
{
Config = new ComparisonConfig
{
IgnoreConcreteTypes = true
}
};
var obj1 = new object();
var obj2 = new { Id = 1 };
@ycherkes
ycherkes / ObjectIdGeneratorPlayground.cs
Last active February 16, 2024 07:10
Circular reference detection. Why GetHashCode is not valid in this case.
var og = new ObjectIDGenerator();
var a = new { Name = "A" };
var b= new {Name = "A"};
var c = a;
var aid = og.GetId(a, out var firstTime);
var bid = og.GetId(b, out firstTime);
var cid = og.GetId(c, out firstTime);
using Medallion.Shell;
using System.Buffers;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Text;
// Correct behavior
// Sends CTRL+C signal via external signaler process because
// Medallion creates a process with the option CreateNoWindow = true
// So the new process doesn't share the console with the parent
using System.Diagnostics;
// !!! This is not working example !!!
namespace GracefulTermination
{
internal static class Program
{
private static async Task Main()
{
using var process = new Process
@ycherkes
ycherkes / FileSystemName.cs
Last active June 13, 2022 15:06
FileSystemName for .NetFramework4
using System.Text;
namespace System.IO.Enumeration
{
/// <summary>
/// Provides methods for matching file system names.
/// </summary>
public static class FileSystemName
{