diff --git a/.gitignore b/.gitignore index 0fdf90e9eb..4a5c4da318 100644 --- a/.gitignore +++ b/.gitignore @@ -208,3 +208,9 @@ FakesAssemblies/ # Binlog *.binlog + +# macOS +.DS_Store + +# VSCode +.mono diff --git a/src/Maui/Prism.Maui/Common/MvvmHelpers.cs b/src/Maui/Prism.Maui/Common/MvvmHelpers.cs index b113162cf0..625879d6b8 100644 --- a/src/Maui/Prism.Maui/Common/MvvmHelpers.cs +++ b/src/Maui/Prism.Maui/Common/MvvmHelpers.cs @@ -1,4 +1,6 @@ +#nullable enable using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using System.Reflection; using Prism.Dialogs; using Prism.Navigation; @@ -11,14 +13,14 @@ namespace Prism.Common; public static class MvvmHelpers { - public static void InvokeViewAndViewModelAction(object view, Action action) where T : class + public static void InvokeViewAndViewModelAction(object? view, Action action) where T : class { if (view is T viewAsT) { action(viewAsT); } - if (view is BindableObject element && element.BindingContext is T viewModelAsT) + if (view is BindableObject { BindingContext: T viewModelAsT }) { action(viewModelAsT); } @@ -32,14 +34,14 @@ public static void InvokeViewAndViewModelAction(object view, Action action } } - public static async Task InvokeViewAndViewModelActionAsync(object view, Func action) where T : class + public static async Task InvokeViewAndViewModelActionAsync(object? view, Func action) where T : class { if (view is T viewAsT) { await action(viewAsT); } - if (view is BindableObject element && element.BindingContext is T viewModelAsT) + if (view is BindableObject { BindingContext: T viewModelAsT }) { await action(viewModelAsT); } @@ -49,11 +51,11 @@ public static async Task InvokeViewAndViewModelActionAsync(object view, Func< var children = page.GetChildRegions(); if (children is not null) foreach (var child in children) - await InvokeViewAndViewModelActionAsync(child, action); + await InvokeViewAndViewModelActionAsync(child, action); } } - public static void DestroyPage(IView view) + public static void DestroyPage(IView? view) { try { @@ -96,7 +98,7 @@ private static void DestroyChildren(IView page) } } - public static void DestroyWithModalStack(Page page, IList modalStack) + public static void DestroyWithModalStack(Page? page, IList modalStack) { foreach (var childPage in modalStack.Reverse()) { @@ -105,7 +107,7 @@ public static void DestroyWithModalStack(Page page, IList modalStack) DestroyPage(page); } - public static T GetImplementerFromViewOrViewModel(object view) + public static T? GetImplementerFromViewOrViewModel(object view) where T : class { if (view is T viewAsT) @@ -113,7 +115,7 @@ public static T GetImplementerFromViewOrViewModel(object view) return viewAsT; } - if (view is VisualElement element && element.BindingContext is T vmAsT) + if (view is VisualElement { BindingContext: T vmAsT }) { return vmAsT; } @@ -136,12 +138,12 @@ public static bool IsNavigationTarget(object view, NavigationContext navigationC return path == viewType.Name || path == viewType.FullName; } - public static void OnNavigatedFrom(object view, NavigationContext navigationContext) + public static void OnNavigatedFrom(object? view, NavigationContext navigationContext) { InvokeViewAndViewModelAction(view, x => x.OnNavigatedFrom(navigationContext)); } - public static void OnNavigatedTo(object view, NavigationContext navigationContext) + public static void OnNavigatedTo(object? view, NavigationContext navigationContext) { InvokeViewAndViewModelAction(view, x => x.OnNavigatedTo(navigationContext)); } @@ -161,13 +163,13 @@ private static bool CanNavigate(object page, INavigationParameters parameters) return implementer?.CanNavigate(parameters) ?? true; } - public static void OnNavigatedFrom(object page, INavigationParameters parameters) + public static void OnNavigatedFrom(object? page, INavigationParameters parameters) { if (page != null) InvokeViewAndViewModelAction(page, v => v.OnNavigatedFrom(parameters)); } - public static async Task OnInitializedAsync(object page, INavigationParameters parameters) + public static async Task OnInitializedAsync(object? page, INavigationParameters parameters) { if (page is null) return; @@ -175,21 +177,21 @@ public static async Task OnInitializedAsync(object page, INavigationParameters p await InvokeViewAndViewModelActionAsync(page, async v => await v.InitializeAsync(parameters)); } - private static bool HasKey(this IEnumerable> parameters, string name, out string key) + private static bool HasKey(this IEnumerable> parameters, string name, [MaybeNullWhen(returnValue: false)] out string key) { key = parameters.Select(x => x.Key).FirstOrDefault(k => k.Equals(name, StringComparison.InvariantCultureIgnoreCase)); return !string.IsNullOrEmpty(key); } - public static void OnNavigatedTo(object page, INavigationParameters parameters) + public static void OnNavigatedTo(object? page, INavigationParameters parameters) { if (page != null) InvokeViewAndViewModelAction(page, v => v.OnNavigatedTo(parameters)); } - public static Page GetOnNavigatedToTarget(Page page, IView mainPage, bool useModalNavigation) + public static Page? GetOnNavigatedToTarget(Page page, IView? mainPage, bool useModalNavigation) { - Page target; + Page? target; if (useModalNavigation) { var previousPage = GetPreviousPage(page, page.Navigation.ModalStack); @@ -210,9 +212,9 @@ public static Page GetOnNavigatedToTarget(Page page, IView mainPage, bool useMod return target; } - public static Page GetOnNavigatedToTargetFromChild(IView target) + public static Page? GetOnNavigatedToTargetFromChild(IView? target) { - Page child = null; + Page? child = null; if (target is FlyoutPage flyout) child = flyout.Detail; @@ -230,9 +232,9 @@ public static Page GetOnNavigatedToTargetFromChild(IView target) return null; } - public static Page GetPreviousPage(Page currentPage, System.Collections.Generic.IReadOnlyList navStack) + public static Page? GetPreviousPage(Page currentPage, IReadOnlyList navStack) { - Page previousPage = null; + Page? previousPage = null; int currentPageIndex = GetCurrentPageIndex(currentPage, navStack); int previousPageIndex = currentPageIndex - 1; @@ -242,7 +244,7 @@ public static Page GetPreviousPage(Page currentPage, System.Collections.Generic. return previousPage; } - public static int GetCurrentPageIndex(Page currentPage, System.Collections.Generic.IReadOnlyList navStack) + public static int GetCurrentPageIndex(Page currentPage, IReadOnlyList navStack) { int stackCount = navStack.Count; for (int x = 0; x < stackCount; x++) @@ -255,14 +257,14 @@ public static int GetCurrentPageIndex(Page currentPage, System.Collections.Gener return stackCount - 1; } - public static Page GetCurrentPage(Page mainPage) => + public static Page? GetCurrentPage(Page mainPage) => _getCurrentPage(mainPage); [EditorBrowsable(EditorBrowsableState.Never)] - public static void SetCurrentPageDelegate(Func getCurrentPageDelegate) => + public static void SetCurrentPageDelegate(Func getCurrentPageDelegate) => _getCurrentPage = getCurrentPageDelegate; - private static Func _getCurrentPage = mainPage => + private static Func _getCurrentPage = mainPage => { var page = mainPage; @@ -273,7 +275,7 @@ public static void SetCurrentPageDelegate(Func getCurrentPageDelegat return EvaluateCurrentPage(page); }; - private static Page GetTarget(Page target) + private static Page? GetTarget(Page? target) { return target switch { @@ -285,14 +287,14 @@ private static Page GetTarget(Page target) }; } - private static Page EvaluateCurrentPage(Page target) + private static Page? EvaluateCurrentPage(Page? target) { - Page child = GetTarget(target); + Page? child = GetTarget(target); if (child is not null) target = GetOnNavigatedToTargetFromChild(child); - if (target is Page page) + if (target is { } page) { if (target is IDialogContainer) { @@ -319,9 +321,9 @@ public static async Task HandleNavigationPageGoBack(NavigationPage navigationPag { var navigationService = Navigation.Xaml.Navigation.GetNavigationService(navigationPage.CurrentPage); var result = await navigationService.GoBackAsync(); - if (result.Exception is NavigationException navEx && navEx.Message == NavigationException.CannotPopApplicationMainPage) + if (result.Exception is NavigationException { Message: NavigationException.CannotPopApplicationMainPage }) { - Application.Current.Quit(); + Application.Current?.Quit(); } } @@ -335,13 +337,13 @@ public static async Task HandleNavigationPageSwipedAway(NavigationPage navigatio }, }; var result = await navigationService.GoBackAsync(navParams); - if (result.Exception is NavigationException navEx && navEx.Message == NavigationException.CannotPopApplicationMainPage) + if (result.Exception is NavigationException { Message: NavigationException.CannotPopApplicationMainPage }) { - Application.Current.Quit(); + Application.Current?.Quit(); } } - public static void HandleSystemGoBack(IView previousPage, IView currentPage) + public static void HandleSystemGoBack(IView? previousPage, IView? currentPage) { var parameters = new NavigationParameters(); parameters.GetNavigationParametersInternal().Add(KnownInternalParameters.NavigationMode, NavigationMode.Back); @@ -352,22 +354,22 @@ public static void HandleSystemGoBack(IView previousPage, IView currentPage) internal static bool HasDirectNavigationPageParent(Page page) { - return page?.Parent != null && page?.Parent is NavigationPage; + return page.Parent is NavigationPage; } internal static bool HasNavigationPageParent(Page page) => HasNavigationPageParent(page, out var _); - internal static bool HasNavigationPageParent(Page page, out NavigationPage navigationPage) + internal static bool HasNavigationPageParent(Page page, out NavigationPage? navigationPage) { - if (page?.Parent != null) + if (page.Parent != null) { if (page.Parent is NavigationPage navParent) { navigationPage = navParent; return true; } - else if ((page.Parent is TabbedPage) && page.Parent?.Parent is NavigationPage navigationParent) + else if (page.Parent is TabbedPage && page.Parent?.Parent is NavigationPage navigationParent) { navigationPage = navigationParent; return true; diff --git a/src/Prism.Core/Common/IParameters.cs b/src/Prism.Core/Common/IParameters.cs index 4fa05b4cc1..4f1d544d9e 100644 --- a/src/Prism.Core/Common/IParameters.cs +++ b/src/Prism.Core/Common/IParameters.cs @@ -1,6 +1,6 @@ -using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +#nullable enable namespace Prism.Common { /// @@ -65,6 +65,6 @@ public interface IParameters : IEnumerable> /// /// The key of the parameter to get. /// A matching value if it exists. - object this[string key] { get; } + object? this[string key] { get; } } } diff --git a/src/Prism.Core/Common/ListDictionary.cs b/src/Prism.Core/Common/ListDictionary.cs index 4c21b370e9..99d8293f60 100644 --- a/src/Prism.Core/Common/ListDictionary.cs +++ b/src/Prism.Core/Common/ListDictionary.cs @@ -1,6 +1,3 @@ -using System; -using System.Collections.Generic; - namespace Prism.Common { /// diff --git a/src/Prism.Core/Common/ParametersBase.cs b/src/Prism.Core/Common/ParametersBase.cs index 077ff736af..3814e290ce 100644 --- a/src/Prism.Core/Common/ParametersBase.cs +++ b/src/Prism.Core/Common/ParametersBase.cs @@ -1,11 +1,8 @@ -using System; using System.Collections; -using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; -using System.Linq; using System.Text; - +#nullable enable namespace Prism.Common { /// @@ -13,7 +10,7 @@ namespace Prism.Common /// public abstract class ParametersBase : IParameters { - private readonly List> _entries = []; + private readonly List> _entries = []; /// /// Default constructor. @@ -51,7 +48,7 @@ protected ParametersBase(string query) } i++; } - string key = null; + string? key = null; string value; if (num4 >= 0) { @@ -75,7 +72,7 @@ protected ParametersBase(string query) /// /// The key for the value to be returned. /// The value of the parameter referenced by the key; otherwise null. - public object this[string key] + public object? this[string key] { get { @@ -108,7 +105,7 @@ public object this[string key] /// The key to reference this value in the parameters collection. /// The value of the parameter to store. public void Add(string key, object value) => - _entries.Add(new KeyValuePair(key, value)); + _entries.Add(new KeyValuePair(key, value)); /// /// Checks collection for presence of key. @@ -122,7 +119,7 @@ public bool ContainsKey(string key) => /// Gets an enumerator for the KeyValuePairs in parameter collection. /// /// Enumerator. - public IEnumerator> GetEnumerator() => + public IEnumerator> GetEnumerator() => _entries.GetEnumerator(); /// @@ -181,7 +178,7 @@ public override string ToString() queryBuilder.Append(Uri.EscapeDataString(kvp.Key)); queryBuilder.Append('='); - queryBuilder.Append(Uri.EscapeDataString(kvp.Value?.ToString() is string str ? str : string.Empty)); + queryBuilder.Append(Uri.EscapeDataString(kvp.Value?.ToString() ?? string.Empty)); } } @@ -193,7 +190,7 @@ public override string ToString() /// /// An IEnumerable of KeyValuePairs to add to the current parameter list. [EditorBrowsable(EditorBrowsableState.Never)] - public void FromParameters(IEnumerable> parameters) => + public void FromParameters(IEnumerable> parameters) => _entries.AddRange(parameters); } } diff --git a/src/Prism.Core/Common/ParametersExtensions.cs b/src/Prism.Core/Common/ParametersExtensions.cs index 2f6f56d1e9..c34b45895d 100644 --- a/src/Prism.Core/Common/ParametersExtensions.cs +++ b/src/Prism.Core/Common/ParametersExtensions.cs @@ -1,3 +1,4 @@ +#nullable enable using System; using System.Collections.Generic; using System.ComponentModel; @@ -156,13 +157,6 @@ private static bool TryGetValueInternal(KeyValuePair kvp, Type t public static bool ContainsKey(this IEnumerable> parameters, string key) => parameters.Any(x => string.Compare(x.Key, key, StringComparison.Ordinal) == 0); - private static object GetDefault(Type type) - { - if (type.IsValueType) - { - return Activator.CreateInstance(type); - } - return null; - } + private static object? GetDefault(Type type) => type.IsValueType ? Activator.CreateInstance(type) : null; } } diff --git a/src/Prism.Core/Common/UriParsingHelper.cs b/src/Prism.Core/Common/UriParsingHelper.cs index f768ac1059..e13dbcf7a6 100644 --- a/src/Prism.Core/Common/UriParsingHelper.cs +++ b/src/Prism.Core/Common/UriParsingHelper.cs @@ -1,8 +1,7 @@ -using System; -using System.Collections.Generic; using Prism.Dialogs; using Prism.Navigation; +#nullable enable namespace Prism.Common { /// @@ -10,7 +9,7 @@ namespace Prism.Common /// public static class UriParsingHelper { - private static readonly char[] _pathDelimiter = { '/' }; + private static readonly char[] _pathDelimiter = ['/']; /// /// Gets the Uri segments from a deep linked Navigation Uri @@ -40,10 +39,7 @@ public static Queue GetUriSegments(Uri uri) /// /// A Navigation Segment /// The navigation segment name from the provided segment. - public static string GetSegmentName(string segment) - { - return segment.Split('?')[0]; - } + public static string GetSegmentName(string segment) => segment.Split('?')[0]; /// /// Gets the Segment Parameters from a Navigation Segment that may contain a querystring @@ -72,11 +68,11 @@ public static INavigationParameters GetSegmentParameters(string segment) /// The segment /// The existing . /// The combined . - public static INavigationParameters GetSegmentParameters(string uriSegment, INavigationParameters parameters) + public static INavigationParameters GetSegmentParameters(string uriSegment, INavigationParameters? parameters) { var navParameters = GetSegmentParameters(uriSegment); - if (parameters != null) + if (parameters is not null) { foreach (KeyValuePair navigationParameter in parameters) { @@ -114,7 +110,7 @@ public static IDialogParameters GetSegmentDialogParameters(string segment) /// A navigation segment which may contain a querystring. /// Existing . /// - public static IDialogParameters GetSegmentParameters(string uriSegment, IDialogParameters parameters) + public static IDialogParameters GetSegmentParameters(string uriSegment, IDialogParameters? parameters) { var dialogParameters = GetSegmentDialogParameters(uriSegment); @@ -133,19 +129,13 @@ public static IDialogParameters GetSegmentParameters(string uriSegment, IDialogP /// Gets the query part of . /// /// The Uri. - public static string GetQuery(Uri uri) - { - return EnsureAbsolute(uri).Query; - } + public static string GetQuery(Uri uri) => EnsureAbsolute(uri).Query; /// /// Gets the AbsolutePath part of . /// /// The Uri. - public static string GetAbsolutePath(Uri uri) - { - return EnsureAbsolute(uri).AbsolutePath; - } + public static string GetAbsolutePath(Uri uri) => EnsureAbsolute(uri).AbsolutePath; /// /// Parses the query of into a dictionary. @@ -166,16 +156,14 @@ public static INavigationParameters ParseQuery(Uri uri) /// Throws an when the string is null or empty. public static Uri Parse(string uri) { - if (uri == null) throw new ArgumentNullException(nameof(uri)); - - if (uri.StartsWith("/", StringComparison.Ordinal)) - { - return new Uri("http://localhost" + uri, UriKind.Absolute); - } - else + if (uri == null) { - return new Uri(uri, UriKind.RelativeOrAbsolute); + throw new ArgumentNullException(nameof(uri)); } + + return uri.StartsWith("/", StringComparison.Ordinal) + ? new Uri("http://localhost" + uri, UriKind.Absolute) + : new Uri(uri, UriKind.RelativeOrAbsolute); } /// @@ -191,11 +179,7 @@ public static Uri EnsureAbsolute(Uri uri) return uri; } - if ((uri != null) && !uri.OriginalString.StartsWith("/", StringComparison.Ordinal)) - { - return new Uri("http://localhost/" + uri, UriKind.Absolute); - } - return new Uri("http://localhost" + uri, UriKind.Absolute); + return !uri.OriginalString.StartsWith("/", StringComparison.Ordinal) ? new Uri("http://localhost/" + uri, UriKind.Absolute) : new Uri("http://localhost" + uri, UriKind.Absolute); } } } diff --git a/src/Prism.Core/Navigation/NavigationResult.cs b/src/Prism.Core/Navigation/NavigationResult.cs index 19318edfdc..0b14e5767b 100644 --- a/src/Prism.Core/Navigation/NavigationResult.cs +++ b/src/Prism.Core/Navigation/NavigationResult.cs @@ -31,7 +31,7 @@ public NavigationResult(bool success) /// Initializes a new NavigationResult with an /// /// The encountered as part of the navigation. - public NavigationResult(Exception ex) + public NavigationResult(Exception? ex) { Exception = ex; } diff --git a/src/ReadMe.md b/src/ReadMe.md index 8e62575dba..5ed0259990 100644 --- a/src/ReadMe.md +++ b/src/ReadMe.md @@ -28,11 +28,11 @@ You **cannot** use this product without: 1. Possessing either a Community License or a Commercial License. 2. Agreeing and abiding by Prism's license containing all terms and conditions. -To view the full Prism license containing the terms and conditions, please visit [this link](https://prismlibrary.com/downloads/prism_license.pdf). +To view the full Prism license containing the terms and conditions, please visit [this link](https://cdn.prismlibrary.com/downloads/prism_license.pdf). ## How to Purchase Your License: 1. Determine if you qualify for the Prism Community License by reviewing the criteria above. -2. If you qualify, make sure to read, understand, and agree to Prism's terms and conditions found in the [Prism License](https://prismlibrary.com/downloads/prism_license.pdf). +2. If you qualify, make sure to read, understand, and agree to Prism's terms and conditions found in the [Prism License](https://cdn.prismlibrary.com/downloads/prism_license.pdf). 3. If you do not qualify for the Community License, visit the [Prism Library website](https://prismlibrary.com/) for commercial licensing options and further instructions. Thank you for your attention to this matter. We're committed to delivering the best experience with Prism and appreciate your understanding and cooperation. diff --git a/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs b/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs index a39e5d1750..2327ac37fd 100644 --- a/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs +++ b/tests/Maui/Prism.Maui.Tests/Fixtures/Common/UriParsingHelperFixture.cs @@ -1,8 +1,7 @@ -using System; -using Prism.Common; +using Prism.Common; namespace Prism.Maui.Tests.Fixtures.Common; - +#nullable enable public class UriParsingHelperFixture { const string _relativeUri = "MainPage?id=3&name=dan"; @@ -14,7 +13,7 @@ public class UriParsingHelperFixture [Fact] public void ParametersParsedFromNullSegment() { - var parameters = UriParsingHelper.GetSegmentParameters(null); + var parameters = UriParsingHelper.GetSegmentParameters(null!); Assert.NotNull(parameters); } @@ -62,7 +61,7 @@ public void ParametersParsedFromNavigationParametersInRelativeUri() { "name", "dan" } }; - var parameters = UriParsingHelper.GetSegmentParameters("MainPage" + navParameters.ToString()); + var parameters = UriParsingHelper.GetSegmentParameters("MainPage" + navParameters); Assert.NotEmpty(parameters); @@ -82,7 +81,7 @@ public void ParametersParsedFromNavigationParametersInAbsoluteUri() { "name", "dan" } }; - var parameters = UriParsingHelper.GetSegmentParameters("http://www.dansiegel.net/MainPage" + navParameters.ToString()); + var parameters = UriParsingHelper.GetSegmentParameters("http://www.dansiegel.net/MainPage" + navParameters); Assert.NotEmpty(parameters); @@ -93,6 +92,13 @@ public void ParametersParsedFromNavigationParametersInAbsoluteUri() Assert.Equal("dan", parameters["name"]); } + [Fact] + public void TargetNameParsedFromEmptySegment() + { + var target = UriParsingHelper.GetSegmentName(string.Empty); + Assert.Equal(string.Empty, target); + } + [Fact] public void TargetNameParsedFromSingleSegment() { @@ -177,7 +183,7 @@ public void EnsureAbsoluteUriForAbsoluteUri() [Fact] public void ParseForNull() { - var actual = Assert.Throws(() => UriParsingHelper.Parse(null)); + var actual = Assert.Throws(() => UriParsingHelper.Parse(null!)); Assert.NotNull(actual); Assert.Equal("uri", actual.ParamName); } diff --git a/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs b/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs index eb25cc801e..91f4ffb518 100644 --- a/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs +++ b/tests/Prism.Core.Tests/Common/ListDictionaryFixture.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Generic; using Prism.Common; using Xunit; -namespace Prism.Wpf.Tests +namespace Prism.Tests.Common { public class ListDictionaryFixture diff --git a/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs b/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs index 671f990144..b59252be1c 100644 --- a/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs +++ b/tests/Prism.Core.Tests/Common/Mocks/MockParameters.cs @@ -4,7 +4,7 @@ namespace Prism.Tests.Common.Mocks { internal class MockParameters : ParametersBase { - public MockParameters() : base() { } + public MockParameters() { } public MockParameters(string query) : base(query) { } } } diff --git a/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs b/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs index d5b7026fcf..65d756fd48 100644 --- a/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs +++ b/tests/Prism.Core.Tests/Common/MulticastExceptionHandlerFixture.cs @@ -1,10 +1,7 @@ -using System; -using System.IO; -using System.Threading.Tasks; -using Prism.Common; +using Prism.Common; using Xunit; -namespace Prism.Core.Tests.Common; +namespace Prism.Tests.Common; #nullable enable public class MulticastExceptionHandlerFixture diff --git a/tests/Prism.Core.Tests/Common/ParametersFixture.cs b/tests/Prism.Core.Tests/Common/ParametersFixture.cs index abd2aa8cf0..ae629460dd 100644 --- a/tests/Prism.Core.Tests/Common/ParametersFixture.cs +++ b/tests/Prism.Core.Tests/Common/ParametersFixture.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using System.Linq; +#nullable enable using Prism.Tests.Common.Mocks; using Xunit; @@ -28,7 +27,7 @@ public void GetValuesOfT() { var parameters = new MockParameters("mock=Foo&mock=2&mock=Fizz"); - IEnumerable values = default; + IEnumerable values = []; var ex = Record.Exception(() => values = parameters.GetValues("mock")); Assert.Null(ex);