From 8b3696b4a14e84420fc56f5b560cf855a012b8de Mon Sep 17 00:00:00 2001 From: Andreas Gullberg Larsen Date: Sat, 28 Dec 2024 00:15:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=A5Change=20UnitParser=20ctor=20to=20r?= =?UTF-8?q?equire=20unit=20abbreviations=20cache=20(#1477)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref #1200 - Throw if `null` is given - Remove fallback to default unit abbreviations --- UnitsNet/CustomCode/UnitParser.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UnitsNet/CustomCode/UnitParser.cs b/UnitsNet/CustomCode/UnitParser.cs index aecc6d526d..d3dab403cc 100644 --- a/UnitsNet/CustomCode/UnitParser.cs +++ b/UnitsNet/CustomCode/UnitParser.cs @@ -23,11 +23,11 @@ public sealed class UnitParser /// /// Create a parser using the given unit abbreviations cache. /// - /// - // TODO Change this to not fallback to built-in units abbreviations when given null, in v6: https://github.com/angularsen/UnitsNet/issues/1200 - public UnitParser(UnitAbbreviationsCache? unitAbbreviationsCache) + /// The unit abbreviations to parse with. + /// No unit abbreviations cache was given. + public UnitParser(UnitAbbreviationsCache unitAbbreviationsCache) { - _unitAbbreviationsCache = unitAbbreviationsCache ?? UnitsNetSetup.Default.UnitAbbreviations; + _unitAbbreviationsCache = unitAbbreviationsCache ?? throw new ArgumentNullException(nameof(unitAbbreviationsCache)); } ///