From 92caed83ac06db5e6ef1f32b528c922669e81477 Mon Sep 17 00:00:00 2001 From: Ahmet Sait Date: Tue, 9 Jul 2024 18:22:22 +0300 Subject: [PATCH] Fix #128: Roll back to net462 by replacing tuples with anonymous types --- Scintilla.NET/FlagsConverter.cs | 6 +++--- Scintilla.NET/Scintilla.NET.csproj | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Scintilla.NET/FlagsConverter.cs b/Scintilla.NET/FlagsConverter.cs index 57b818c..2d58163 100644 --- a/Scintilla.NET/FlagsConverter.cs +++ b/Scintilla.NET/FlagsConverter.cs @@ -32,14 +32,14 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul ulong bits = 0; List enums = []; var items = Enum.GetValues(enumType).Cast() - .Select(e => (@enum: e, bits: Convert.ToUInt64(e), bitCount: Helpers.PopCount(Convert.ToUInt64(e)))) + .Select(e => new { @enum = e, bits = Convert.ToUInt64(e), bitCount = Helpers.PopCount(Convert.ToUInt64(e))}) .Where(e => e.bits != 0 && e.bitCount > 0) .ToList(); int maxIterations = items.Count; for (int i = 0; i < maxIterations && bits != valueBits && items.Count > 0; i++) { int maxIndex = items - .Select(e => (contrib: Helpers.PopCount(e.bits & valueBits & ~bits), item: e)) + .Select(e => new { contrib = Helpers.PopCount(e.bits & valueBits & ~bits), item = e}) .MaxIndex( (x, y) => // Select one that: (x.contrib != y.contrib) ? (x.contrib - y.contrib) : // Contributes most bits @@ -47,7 +47,7 @@ public override object ConvertTo(ITypeDescriptorContext context, CultureInfo cul (x.item.bits < y.item.bits) ? -1 : (x.item.bits > y.item.bits ? 1 : 0) // With the highest integer value ); - (Enum @enum, ulong bits, byte bitCount) item = items[maxIndex]; + var item = items[maxIndex]; if ((valueBits & item.bits) == item.bits && (bits & item.bits) != item.bits) { diff --git a/Scintilla.NET/Scintilla.NET.csproj b/Scintilla.NET/Scintilla.NET.csproj index 97adc7c..9e8aea8 100644 --- a/Scintilla.NET/Scintilla.NET.csproj +++ b/Scintilla.NET/Scintilla.NET.csproj @@ -1,7 +1,7 @@  {22AE2386-60F1-476E-9303-61CDB0AAC4CF} - net47;net6.0-windows + net462;net6.0-windows en-US Source Editing Component based on Scintilla 5 series. Copyright (c) Jacob Slusser 2018, VPKSoft, cyber960 2022, desjarlais 2023.