From be02b6f91f55055e09f32dc44a29eb7646d519eb Mon Sep 17 00:00:00 2001 From: Marc Hernandez Date: Mon, 1 Jul 2024 14:47:24 -0700 Subject: [PATCH] Consolidate imports, wrap metadata in struct, update type constraints x) Consolidate imports for Immutable collections x) Wrap metadata into its own struct x) Update type constraints for generic methods --- Globals.cs | 5 ++++- imm/iu.cs | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Globals.cs b/Globals.cs index 459ec00..0bb2279 100644 --- a/Globals.cs +++ b/Globals.cs @@ -1,6 +1,9 @@ +global using Imm = System.Collections.Immutable; +global using II = System.Collections.Immutable.ImmutableInterlocked; + global using ImmArray = System.Collections.Immutable.ImmutableArray; global using ImmDict = System.Collections.Immutable.ImmutableDictionary; global using ImmSet = System.Collections.Immutable.ImmutableHashSet; -global using II = System.Collections.Immutable.ImmutableInterlocked; + diff --git a/imm/iu.cs b/imm/iu.cs index ffd6541..d048dfe 100644 --- a/imm/iu.cs +++ b/imm/iu.cs @@ -7,7 +7,6 @@ // x) Wrap metadata into its own struct // x) Make metadata a struct vs a class -using imm; using System; using System.Runtime.CompilerServices; @@ -22,20 +21,20 @@ static public class iu [CallerLineNumber] int dbgLine = 0, [CallerArgumentExpression("fn")] string dbgExpression = default ) - where T : Recorded, Imm + where T : imm.Recorded, imm.Imm { obj = obj.Process( fn, reason, dbgName, dbgPath, dbgLine, dbgExpression ); return obj; } - static public Timed Process( ref Timed obj, Func fn, + static public imm.Timed Process( ref imm.Timed obj, Func fn, string reason = "", [CallerMemberName] string dbgName = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = 0, [CallerArgumentExpression("fn")] string dbgExpression = default ) - where T : Timed, Imm + where T : imm.Timed, imm.Imm { obj = obj.Process( fn, reason, dbgName, dbgPath, dbgLine, dbgExpression ); return obj; @@ -49,7 +48,7 @@ static public class iu [CallerLineNumber] int dbgLine = 0, [CallerArgumentExpression("fn")] string dbgExpression = default ) - where T : Versioned, Imm + where T : imm.Versioned, imm.Imm { obj = obj.Process( fn, reason ); return obj;