diff --git a/Directory.Build.props b/Directory.Build.props
index 6669bd9..24400a6 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -40,14 +40,16 @@
CS1712: Type parameter has no matching typeparam tag in the XML comment
CS1723: XML comment has cref attribute that refers to a type parameter
CS1734: XML comment has a paramref tag, but there is no parameter by that name
- xUnit1012: Null should not be used for type parameter
- xUnit2021: Assert.ThrowsAsync is async. The resulting task should be awaited
+ NUnit*: NUnit Analyzers
IL2***: Trim Warnings
IL3***: AOT Warnings-->
nullable,
CS0419,CS1570,CS1571,CS1572,CS1573,CS1574,CS1580,CS1581,CS1584,CS1587,CS1589,CS1590,CS1591,CS1592,CS1598,CS1658,CS1710,CS1711,CS1712,CS1723,CS1734,
- xUnit1012,xUnit2021,
+ NUnit1001,NUnit1002,NUnit1003,NUnit1004,NUnit1005,NUnit1006,NUnit1007,NUnit1008,NUnit1009,NUnit1010,NUnit1011,NUnit1012,NUnit1013,NUnit1014,NUnit1015,NUnit1016,NUnit1017,NUnit1018,NUnit1019,NUnit1020,NUnit1021,NUnit1022,NUnit1023,NUnit1024,NUnit1025,NUnit1026,NUnit1027,NUnit1028,NUnit1029,NUnit1030,NUnit1031,NUnit1032,NUnit1033,
+ NUnit2001,NUnit2002,NUnit2003,NUnit2004,NUnit2005,NUnit2006,NUnit2007,NUnit2008,NUnit2009,NUnit2010,NUnit2011,NUnit2012,NUnit2013,NUnit2014,NUnit2015,NUnit2016,NUnit2017,NUnit2018,NUnit2019,NUnit2020,NUnit2021,NUnit2022,NUnit2023,NUnit2024,NUnit2025,NUnit2026,NUnit2027,NUnit2028,NUnit2029,NUnit2030,NUnit2031,NUnit2032,NUnit2033,NUnit2034,NUnit2035,NUnit2036,NUnit2037,NUnit2038,NUnit2039,NUnit2040,NUnit2041,NUnit2042,NUnit2043,NUnit2044,NUnit2045,NUnit2046,NUnit2047,NUnit2048,NUnit2049,NUnit2050,
+ NUnit3001,NUnit3002,NUnit3003,NUnit3004,
+ NUnit4001
IL2001,IL2002,IL2003,IL2004,IL2005,IL2006,IL2007,IL2008,IL2009,
IL2010,IL2011,IL2012,IL2013,IL2014,IL2015,IL2016,IL2017,IL2018,IL2019,
IL2020,IL2021,IL2022,IL2023,IL2024,IL2025,IL2026,IL2027,IL2028,IL2029,
@@ -62,7 +64,7 @@
IL2110,IL2111,IL2112,IL2113,IL2114,IL2115,IL2116,IL2117,IL2118,IL2119,
IL2120,IL2121,IL2122,
IL3050,IL3051,IL3052,IL3053,IL3054,IL3055,IL3056
-
+
diff --git a/samples/CommunityToolkit.Maui.Markup.Sample/AppShell.cs b/samples/CommunityToolkit.Maui.Markup.Sample/AppShell.cs
index 3526318..5eb5a0a 100644
--- a/samples/CommunityToolkit.Maui.Markup.Sample/AppShell.cs
+++ b/samples/CommunityToolkit.Maui.Markup.Sample/AppShell.cs
@@ -4,12 +4,12 @@ namespace CommunityToolkit.Maui.Markup.Sample;
class AppShell : Shell
{
- static readonly IReadOnlyDictionary pageRouteMappingDictionary = new Dictionary(new[]
- {
+ static readonly IReadOnlyDictionary pageRouteMappingDictionary = new Dictionary(
+ [
CreateRoutePageMapping(),
CreateRoutePageMapping(),
- CreateRoutePageMapping(),
- });
+ CreateRoutePageMapping()
+ ]);
public AppShell(NewsPage newsPage)
{
diff --git a/samples/CommunityToolkit.Maui.Markup.Sample/ViewModels/NewsViewModel.cs b/samples/CommunityToolkit.Maui.Markup.Sample/ViewModels/NewsViewModel.cs
index fe8dcb7..7850b13 100644
--- a/samples/CommunityToolkit.Maui.Markup.Sample/ViewModels/NewsViewModel.cs
+++ b/samples/CommunityToolkit.Maui.Markup.Sample/ViewModels/NewsViewModel.cs
@@ -26,7 +26,7 @@ sealed partial class NewsViewModel : BaseViewModel, IDisposable
remove => pullToRefreshEventManager.RemoveEventHandler(value);
}
- public ObservableCollection TopStoryCollection { get; } = new();
+ public ObservableCollection TopStoryCollection { get; } = [];
public void Dispose()
{
diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/AutomationPropertiesExtensionsTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/AutomationPropertiesExtensionsTests.cs
index 027c2ab..ced9dc4 100644
--- a/src/CommunityToolkit.Maui.Markup.UnitTests/AutomationPropertiesExtensionsTests.cs
+++ b/src/CommunityToolkit.Maui.Markup.UnitTests/AutomationPropertiesExtensionsTests.cs
@@ -12,7 +12,7 @@ class AutomationPropertiesExtensionsTests : BaseMarkupTestFixture
const bool isExcluded = true;
Bindable.AutomationExcludedWithChildren(isExcluded);
- Assert.That(AutomationProperties.GetExcludedWithChildren(Bindable) == isExcluded);
+ Assert.That(AutomationProperties.GetExcludedWithChildren(Bindable), Is.EqualTo(isExcluded));
}
[Test]
@@ -21,6 +21,6 @@ class AutomationPropertiesExtensionsTests : BaseMarkupTestFixture
const bool isInTree = false;
Bindable.AutomationIsInAccessibleTree(isInTree);
- Assert.That(AutomationProperties.GetIsInAccessibleTree(Bindable) == isInTree);
+ Assert.That(AutomationProperties.GetIsInAccessibleTree(Bindable), Is.EqualTo(isInTree));
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/BindableObjectMultiBindExtensionsTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/BindableObjectMultiBindExtensionsTests.cs
index 705a1b7..4e9beed 100644
--- a/src/CommunityToolkit.Maui.Markup.UnitTests/BindableObjectMultiBindExtensionsTests.cs
+++ b/src/CommunityToolkit.Maui.Markup.UnitTests/BindableObjectMultiBindExtensionsTests.cs
@@ -17,23 +17,27 @@ class BindableObjectMultiBindExtensionsTests : BaseMarkupTestFixture
viewModel = new ViewModel();
- testBindings = new List
- {
+ testBindings =
+ [
new Binding(nameof(viewModel.Text)),
new Binding(nameof(viewModel.Id)),
+
new Binding(nameof(viewModel.IsDone)),
new Binding(nameof(viewModel.Fraction)),
- new Binding(nameof(viewModel.Count))
- };
- testConvertValues = new List
- {
+ new Binding(nameof(viewModel.Count))
+ ];
+
+ testConvertValues =
+ [
"Hi",
Guid.Parse("{272383A4-92E3-46BA-99DC-438D81E039AB}"),
+
true,
0.5,
+
3
- };
+ ];
}
[TearDown]
@@ -425,7 +429,7 @@ class BindableObjectMultiBindExtensionsTests : BaseMarkupTestFixture
ArgumentNullException.ThrowIfNull(formatted);
var result = Unformat(0, formatted);
- return new object[] { result.Text ?? string.Empty, result.Id, result.IsDone, result.Fraction, result.Count };
+ return [result.Text ?? string.Empty, result.Id, result.IsDone, result.Fraction, result.Count];
};
}
@@ -455,7 +459,7 @@ class BindableObjectMultiBindExtensionsTests : BaseMarkupTestFixture
ArgumentNullException.ThrowIfNull(text);
var unformattedResult = Unformat(parameter, text);
- return new object[] { unformattedResult.Text ?? string.Empty, unformattedResult.Id, unformattedResult.IsDone, unformattedResult.Fraction, unformattedResult.Count };
+ return [unformattedResult.Text ?? string.Empty, unformattedResult.Id, unformattedResult.IsDone, unformattedResult.Fraction, unformattedResult.Count];
};
}
diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/BindingHelpers.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/BindingHelpers.cs
index a2c6560..6c7b371 100644
--- a/src/CommunityToolkit.Maui.Markup.UnitTests/BindingHelpers.cs
+++ b/src/CommunityToolkit.Maui.Markup.UnitTests/BindingHelpers.cs
@@ -216,10 +216,7 @@ static class BindingHelpers
{
getContextMethodInfo ??= typeof(BindableObject).GetMethod("GetContext", BindingFlags.NonPublic | BindingFlags.Instance);
- var context = getContextMethodInfo?.Invoke(bindable, new object[]
- {
- property
- });
+ var context = getContextMethodInfo?.Invoke(bindable, [property]);
if (context is null)
{
return null;
@@ -253,7 +250,7 @@ static class BindingHelpers
if (twoWay || backOnly)
{
- Assert.That(convertedBackValues.Length, Is.EqualTo(values.Length));
+ Assert.That(convertedBackValues, Has.Length.EqualTo(values.Length));
for (var i = 0; i < values.Length; i++)
{
Assert.That(convertedBackValues[i], Is.EqualTo(values[i]));
diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/ElementExtensionsTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/ElementExtensionsTests.cs
index cbff686..adcd342 100644
--- a/src/CommunityToolkit.Maui.Markup.UnitTests/ElementExtensionsTests.cs
+++ b/src/CommunityToolkit.Maui.Markup.UnitTests/ElementExtensionsTests.cs
@@ -31,7 +31,7 @@ class ElementExtensionsTests : BaseMarkupTestFixture
var effect1 = new NullEffect();
Bindable.Effects(effect1);
- Assert.That(Bindable.Effects.Count, Is.EqualTo(1));
+ Assert.That(Bindable.Effects, Has.Count.EqualTo(1));
Assert.That(Bindable.Effects.Contains(effect1));
}
@@ -41,12 +41,12 @@ class ElementExtensionsTests : BaseMarkupTestFixture
Bindable.Effects.Clear();
Assume.That(Bindable.Effects.Count, Is.EqualTo(0));
- NullEffect effect1 = new NullEffect(), effect2 = new NullEffect();
+ NullEffect effect1 = new(), effect2 = new();
Bindable.Effects(effect1, effect2);
Assert.Multiple(() =>
{
- Assert.That(Bindable.Effects.Count, Is.EqualTo(2));
+ Assert.That(Bindable.Effects, Has.Count.EqualTo(2));
Assert.That(Bindable.Effects.Contains(effect1));
Assert.That(Bindable.Effects.Contains(effect2));
});
diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/FuncConverterTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/FuncConverterTests.cs
index b731f7d..67fd94c 100644
--- a/src/CommunityToolkit.Maui.Markup.UnitTests/FuncConverterTests.cs
+++ b/src/CommunityToolkit.Maui.Markup.UnitTests/FuncConverterTests.cs
@@ -30,21 +30,21 @@ class FuncConverterTests : BaseMarkupTestFixture
(text, addOne, culture) =>
{
convertBackCulture = culture;
- return new object[]
- {
- text?.Length > 0 ? text[0] : '\0',
- (text?.Length ?? 0) - (addOne ? 1 : 0)
- };
+ return
+ [
+ text?.Length > 0 ? text[0] : '\0',
+ (text?.Length ?? 0) - (addOne ? 1 : 0)
+ ];
})
- .AssertConvert(new object[] { 'a', 2 }, true, "aaa", twoWay: true, culture: expectedCulture)
- .AssertConvert(new object[] { 'b', 4 }, false, "bbbb", twoWay: true, culture: expectedCulture);
+ .AssertConvert(['a', 2], true, "aaa", twoWay: true, culture: expectedCulture)
+ .AssertConvert(['b', 4], false, "bbbb", twoWay: true, culture: expectedCulture);
Assert.Multiple(() =>
{
Assert.That(convertCulture, Is.EqualTo(expectedCulture));
Assert.That(convertBackCulture, Is.EqualTo(expectedCulture));
- Assert.That(converter.Convert(new object[] { 'a', 2 }, null, null, CultureInfo.InvariantCulture), Is.EqualTo("aa"));
+ Assert.That(converter.Convert(['a', 2], null, null, CultureInfo.InvariantCulture), Is.EqualTo("aa"));
});
var backValues = converter.ConvertBack(null, null, null, CultureInfo.InvariantCulture);
@@ -74,15 +74,16 @@ class FuncConverterTests : BaseMarkupTestFixture
},
(text, addOne) =>
{
- return new object[] {
- text?.Length > 0 ? text[0] : '\0',
- (text?.Length ?? 0) - (addOne ? 1 : 0)
- };
+ return
+ [
+ text?.Length > 0 ? text[0] : '\0',
+ (text?.Length ?? 0) - (addOne ? 1 : 0)
+ ];
})
- .AssertConvert(new object[] { 'a', 2 }, true, "aaa", twoWay: true)
- .AssertConvert(new object[] { 'b', 4 }, false, "bbbb", twoWay: true);
+ .AssertConvert(['a', 2], true, "aaa", twoWay: true)
+ .AssertConvert(['b', 4], false, "bbbb", twoWay: true);
- Assert.That(converter.Convert(new object[] { 'a', 2 }, null, null, CultureInfo.InvariantCulture), Is.EqualTo("aa"));
+ Assert.That(converter.Convert(['a', 2], null, null, CultureInfo.InvariantCulture), Is.EqualTo("aa"));
var backValues = converter.ConvertBack(null, null, null, CultureInfo.InvariantCulture);
Assert.Multiple(() =>
@@ -105,15 +106,16 @@ class FuncConverterTests : BaseMarkupTestFixture
},
(text) =>
{
- return new object[] {
- text?.Length > 0 ? text[0] : '\0',
- text?.Length ?? 0
- };
+ return
+ [
+ text?.Length > 0 ? text[0] : '\0',
+ text?.Length ?? 0
+ ];
})
- .AssertConvert(new object[] { 'a', 2 }, true, "aa", twoWay: true)
- .AssertConvert(new object[] { 'b', 4 }, false, "bbbb", twoWay: true);
+ .AssertConvert(['a', 2], true, "aa", twoWay: true)
+ .AssertConvert(['b', 4], false, "bbbb", twoWay: true);
- Assert.That(converter.Convert(new object[] { 'a', 2 }, null, null, CultureInfo.InvariantCulture), Is.EqualTo("aa"));
+ Assert.That(converter.Convert(['a', 2], null, null, CultureInfo.InvariantCulture), Is.EqualTo("aa"));
var backValues = converter.ConvertBack(null, null, null, CultureInfo.InvariantCulture);
diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/GesturesExtensionsTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/GesturesExtensionsTests.cs
index 483292a..174da83 100644
--- a/src/CommunityToolkit.Maui.Markup.UnitTests/GesturesExtensionsTests.cs
+++ b/src/CommunityToolkit.Maui.Markup.UnitTests/GesturesExtensionsTests.cs
@@ -15,7 +15,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
gestureElement.BindClickGesture(nameof(ViewModel.SetGuidCommand));
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
BindingHelpers.AssertBindingExists((ClickGestureRecognizer)gestureElement.GestureRecognizers[0], ClickGestureRecognizer.CommandProperty, nameof(ViewModel.SetGuidCommand));
}
@@ -34,7 +34,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(((ClickGestureRecognizer)gestureElement.GestureRecognizers[0]).NumberOfClicksRequired, Is.EqualTo(numberOfClicks));
});
@@ -50,7 +50,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
gestureElement.BindTapGesture(nameof(ViewModel.SetGuidCommand));
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
BindingHelpers.AssertBindingExists((TapGestureRecognizer)gestureElement.GestureRecognizers[0], TapGestureRecognizer.CommandProperty, nameof(ViewModel.SetGuidCommand));
}
@@ -68,7 +68,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(((TapGestureRecognizer)gestureElement.GestureRecognizers[0]).NumberOfTapsRequired, Is.EqualTo(numberOfTaps));
});
@@ -91,7 +91,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
Assert.Multiple(() =>
{
Assert.That(clicks, Is.GreaterThan(0));
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(((ClickGestureRecognizer)gestureElement.GestureRecognizers[0]).NumberOfClicksRequired, Is.EqualTo(numberOfClicks));
});
@@ -111,7 +111,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
Assert.Multiple(() =>
{
Assert.That(taps, Is.GreaterThan(0));
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(((TapGestureRecognizer)gestureElement.GestureRecognizers[0]).NumberOfTapsRequired, Is.EqualTo(numberOfTaps));
});
@@ -124,7 +124,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
gestureElement.BindSwipeGesture(nameof(ViewModel.SetGuidCommand));
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
BindingHelpers.AssertBindingExists((SwipeGestureRecognizer)gestureElement.GestureRecognizers[0], SwipeGestureRecognizer.CommandProperty, nameof(ViewModel.SetGuidCommand));
}
@@ -143,7 +143,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(((SwipeGestureRecognizer)gestureElement.GestureRecognizers[0]).Direction, Is.EqualTo(direction));
Assert.That(((SwipeGestureRecognizer)gestureElement.GestureRecognizers[0]).Threshold, Is.EqualTo(threshold));
@@ -167,7 +167,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
Assert.Multiple(() =>
{
Assert.That(panCount, Is.EqualTo(1));
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(((PanGestureRecognizer)gestureElement.GestureRecognizers[0]).TouchPoints, Is.EqualTo(touchPoints));
});
@@ -188,7 +188,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
Assert.Multiple(() =>
{
Assert.That(pinchCount, Is.EqualTo(1));
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(pinchCount));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(pinchCount));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
});
@@ -210,7 +210,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
Assert.Multiple(() =>
{
Assert.That(swipeCount, Is.EqualTo(1));
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(((SwipeGestureRecognizer)gestureElement.GestureRecognizers[0]).Direction, Is.EqualTo(direction));
Assert.That(((SwipeGestureRecognizer)gestureElement.GestureRecognizers[0]).Threshold, Is.EqualTo(threshold));
@@ -229,7 +229,7 @@ class GesturesExtensionsTests : BaseMarkupTestFixture where TGe
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(2));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(2));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(gestureElement.GestureRecognizers[1], Is.InstanceOf());
});
@@ -258,7 +258,7 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
});
@@ -278,15 +278,15 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
gestureElement.BindClickGesture(
static (ViewModel vm) => vm.NestedCommand.SetGuidCommand,
- new (Func, string)[]
- {
- (vm => vm, nameof(ViewModel.NestedCommand)), (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand)),
- },
+ [
+ (vm => vm, nameof(ViewModel.NestedCommand)),
+ (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand))
+ ],
mode: BindingMode.OneTime);
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
});
@@ -314,7 +314,7 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(((ClickGestureRecognizer)gestureElement.GestureRecognizers[0]).NumberOfClicksRequired, Is.EqualTo(numberOfClicks));
});
@@ -338,22 +338,23 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
object parameterSource = gestureElement.BindingContext;
gestureElement.BindClickGesture(
- static (ViewModel vm) => vm.NestedCommand.SetGuidCommand,
- new (Func, string)[]
+ getter: static (ViewModel vm) => vm.NestedCommand.SetGuidCommand,
+ handlers: new (Func, string)[]
{
- (vm => vm, nameof(ViewModel.NestedCommand)), (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand)),
+ (vm => vm, nameof(ViewModel.NestedCommand)), (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand))
},
commandBindingMode: BindingMode.OneTime,
parameterGetter: static (ViewModel vm) => vm.NestedCommand.Id,
- parameterHandlers: new (Func, string)[]
- {
- (vm => vm, nameof(ViewModel.NestedCommand)), (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.Id)),
- },
+ parameterHandlers:
+ [
+ (vm => vm, nameof(ViewModel.NestedCommand)),
+ (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.Id))
+ ],
numberOfClicksRequired: numberOfClicks);
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(((ClickGestureRecognizer)gestureElement.GestureRecognizers[0]).NumberOfClicksRequired, Is.EqualTo(numberOfClicks));
});
@@ -376,7 +377,7 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
});
@@ -392,16 +393,17 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
};
gestureElement.BindTapGesture(
- static (ViewModel vm) => vm.NestedCommand.SetGuidCommand,
- new (Func, string)[]
- {
- (vm => vm, nameof(ViewModel.NestedCommand)), (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand)),
- },
+ getter: static (ViewModel vm) => vm.NestedCommand.SetGuidCommand,
+ handlers:
+ [
+ (vm => vm, nameof(ViewModel.NestedCommand)),
+ (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand))
+ ],
mode: BindingMode.OneTime);
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
});
@@ -436,7 +438,7 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
Assert.Multiple(() =>
{
Assert.That(viewModel.Id, Is.EqualTo(guid));
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(tapGestureRecognizer.NumberOfTapsRequired, Is.EqualTo(numberOfTaps));
});
@@ -458,24 +460,26 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
object parameterSource = gestureElement.BindingContext;
gestureElement.BindTapGesture(
- static (ViewModel vm) => vm.NestedCommand.SetGuidCommand,
- new (Func, string)[]
- {
- (vm => vm, nameof(ViewModel.NestedCommand)), (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand)),
- },
+ getter: static (ViewModel vm) => vm.NestedCommand.SetGuidCommand,
+ handlers:
+ [
+ (vm => vm, nameof(ViewModel.NestedCommand)),
+ (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand))
+ ],
commandBindingMode: BindingMode.OneTime,
parameterGetter: static (ViewModel vm) => vm.NestedCommand.Id,
- parameterHandlers: new (Func, string)[]
- {
- (vm => vm, nameof(ViewModel.NestedCommand)), (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.Id)),
- },
+ parameterHandlers:
+ [
+ (vm => vm, nameof(ViewModel.NestedCommand)),
+ (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.Id))
+ ],
numberOfTapsRequired: numberOfTaps);
var tapGestureRecognizer = (TapGestureRecognizer)gestureElement.GestureRecognizers[0];
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(tapGestureRecognizer.NumberOfTapsRequired, Is.EqualTo(numberOfTaps));
});
@@ -494,7 +498,7 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
gestureElement.BindSwipeGesture(static (ViewModel vm) => vm.SetGuidCommand);
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
BindingHelpers.AssertTypedBindingExists((SwipeGestureRecognizer)gestureElement.GestureRecognizers[0], SwipeGestureRecognizer.CommandProperty, BindingMode.Default, gestureElement.BindingContext);
}
@@ -508,16 +512,17 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
};
gestureElement.BindSwipeGesture(
- static (ViewModel vm) => vm.NestedCommand.SetGuidCommand,
- new (Func, string)[]
- {
- (vm => vm, nameof(ViewModel.NestedCommand)), (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand)),
- },
+ getter: static (ViewModel vm) => vm.NestedCommand.SetGuidCommand,
+ handlers:
+ [
+ (vm => vm, nameof(ViewModel.NestedCommand)),
+ (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand))
+ ],
mode: BindingMode.OneTime);
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
});
@@ -556,7 +561,7 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
Assert.Multiple(() =>
{
Assert.That(viewModel.Id, Is.EqualTo(guid));
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(((SwipeGestureRecognizer)gestureElement.GestureRecognizers[0]).Direction, Is.EqualTo(direction));
Assert.That(((SwipeGestureRecognizer)gestureElement.GestureRecognizers[0]).Threshold, Is.EqualTo(threshold));
@@ -578,23 +583,25 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
};
gestureElement.BindSwipeGesture(
- static (ViewModel vm) => vm.NestedCommand.SetGuidCommand,
- new (Func, string)[]
- {
- (vm => vm, nameof(ViewModel.NestedCommand)), (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand)),
- },
+ getter: static (ViewModel vm) => vm.NestedCommand.SetGuidCommand,
+ handlers:
+ [
+ (vm => vm, nameof(ViewModel.NestedCommand)),
+ (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.SetGuidCommand))
+ ],
commandBindingMode: BindingMode.OneTime,
parameterGetter: static (ViewModel vm) => vm.NestedCommand.Id,
- parameterHandlers: new (Func, string)[]
- {
- (vm => vm, nameof(ViewModel.NestedCommand)), (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.Id)),
- },
+ parameterHandlers:
+ [
+ (vm => vm, nameof(ViewModel.NestedCommand)),
+ (vm => vm.NestedCommand, nameof(ViewModel.NestedCommand.Id))
+ ],
direction: direction,
threshold: threshold);
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(1));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(1));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(((SwipeGestureRecognizer)gestureElement.GestureRecognizers[0]).Direction, Is.EqualTo(direction));
Assert.That(((SwipeGestureRecognizer)gestureElement.GestureRecognizers[0]).Threshold, Is.EqualTo(threshold));
@@ -617,7 +624,7 @@ class GesturesExtensionsTypedBindingsTests : BaseMarkupTestFixt
Assert.Multiple(() =>
{
- Assert.That(gestureElement.GestureRecognizers.Count, Is.EqualTo(3));
+ Assert.That(gestureElement.GestureRecognizers, Has.Count.EqualTo(3));
Assert.That(gestureElement.GestureRecognizers[0], Is.InstanceOf());
Assert.That(gestureElement.GestureRecognizers[1], Is.InstanceOf());
Assert.That(gestureElement.GestureRecognizers[2], Is.InstanceOf());
diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/GridRowsColumns.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/GridRowsColumns.cs
index 490636c..197cbe5 100644
--- a/src/CommunityToolkit.Maui.Markup.UnitTests/GridRowsColumns.cs
+++ b/src/CommunityToolkit.Maui.Markup.UnitTests/GridRowsColumns.cs
@@ -23,7 +23,7 @@ class GridRowsColumns : BaseMarkupTestFixture
Assert.Multiple(() =>
{
- Assert.That(grid.RowDefinitions.Count, Is.EqualTo(4));
+ Assert.That(grid.RowDefinitions, Has.Count.EqualTo(4));
Assert.That(grid.RowDefinitions[0]?.Height, Is.EqualTo(GridLength.Auto));
Assert.That(grid.RowDefinitions[1]?.Height, Is.EqualTo(GridLength.Star));
Assert.That(grid.RowDefinitions[2]?.Height, Is.EqualTo(starsLength));
@@ -46,7 +46,7 @@ class GridRowsColumns : BaseMarkupTestFixture
Assert.Multiple(() =>
{
- Assert.That(grid.RowDefinitions.Count, Is.EqualTo(4));
+ Assert.That(grid.RowDefinitions, Has.Count.EqualTo(4));
Assert.That(grid.RowDefinitions[0]?.Height, Is.EqualTo(GridLength.Auto));
Assert.That(grid.RowDefinitions[1]?.Height, Is.EqualTo(GridLength.Star));
Assert.That(grid.RowDefinitions[2]?.Height, Is.EqualTo(starsLength));
@@ -73,7 +73,7 @@ class GridRowsColumns : BaseMarkupTestFixture
Assert.Multiple(() =>
{
- Assert.That(grid.ColumnDefinitions.Count, Is.EqualTo(5));
+ Assert.That(grid.ColumnDefinitions, Has.Count.EqualTo(5));
Assert.That(grid.ColumnDefinitions[0]?.Width, Is.EqualTo(GridLength.Auto));
Assert.That(grid.ColumnDefinitions[1]?.Width, Is.EqualTo(GridLength.Star));
Assert.That(grid.ColumnDefinitions[2]?.Width, Is.EqualTo(starsLength));
@@ -98,7 +98,7 @@ class GridRowsColumns : BaseMarkupTestFixture
Assert.Multiple(() =>
{
- Assert.That(grid.ColumnDefinitions.Count, Is.EqualTo(5));
+ Assert.That(grid.ColumnDefinitions, Has.Count.EqualTo(5));
Assert.That(grid.ColumnDefinitions[0]?.Width, Is.EqualTo(GridLength.Auto));
Assert.That(grid.ColumnDefinitions[1]?.Width, Is.EqualTo(GridLength.Star));
Assert.That(grid.ColumnDefinitions[2]?.Width, Is.EqualTo(starsLength));
diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/SemanticPropertiesExtensionsTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/SemanticPropertiesExtensionsTests.cs
index b03adfe..b70ef92 100644
--- a/src/CommunityToolkit.Maui.Markup.UnitTests/SemanticPropertiesExtensionsTests.cs
+++ b/src/CommunityToolkit.Maui.Markup.UnitTests/SemanticPropertiesExtensionsTests.cs
@@ -12,7 +12,7 @@ class SemanticPropertiesExtensionsTests : BaseMarkupTestFixture
const string description = "This label does XYZ";
Bindable.SemanticDescription(description);
- Assert.That(SemanticProperties.GetDescription(Bindable) == description);
+ Assert.That(SemanticProperties.GetDescription(Bindable), Is.EqualTo(description));
}
[Test]
@@ -21,7 +21,7 @@ class SemanticPropertiesExtensionsTests : BaseMarkupTestFixture
const SemanticHeadingLevel headingLevel = SemanticHeadingLevel.Level5;
Bindable.SemanticHeadingLevel(headingLevel);
- Assert.That(SemanticProperties.GetHeadingLevel(Bindable) == headingLevel);
+ Assert.That(SemanticProperties.GetHeadingLevel(Bindable), Is.EqualTo(headingLevel));
}
[Test]
@@ -30,6 +30,6 @@ class SemanticPropertiesExtensionsTests : BaseMarkupTestFixture
const string hint = "This label does XYZ";
Bindable.SemanticHint(hint);
- Assert.That(SemanticProperties.GetHint(Bindable) == hint);
+ Assert.That(SemanticProperties.GetHint(Bindable), Is.EqualTo(hint));
}
}
\ No newline at end of file
diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/StyleTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/StyleTests.cs
index 0fb0b89..54fee3b 100644
--- a/src/CommunityToolkit.Maui.Markup.UnitTests/StyleTests.cs
+++ b/src/CommunityToolkit.Maui.Markup.UnitTests/StyleTests.cs
@@ -50,7 +50,7 @@ class StyleTests : BaseMarkupTestFixture
var style = new Style(Label.TextColorProperty, Colors.Red);
Style formsStyle = style;
- Assert.That(formsStyle.Setters.Count, Is.EqualTo(1));
+ Assert.That(formsStyle.Setters, Has.Count.EqualTo(1));
var setter = formsStyle.Setters[0];
@@ -69,7 +69,7 @@ class StyleTests : BaseMarkupTestFixture
(Label.TranslationXProperty, 8.0));
Style formsStyle = style;
- Assert.That(formsStyle.Setters.Count, Is.EqualTo(2));
+ Assert.That(formsStyle.Setters, Has.Count.EqualTo(2));
var setter1 = formsStyle.Setters[0];
@@ -124,7 +124,7 @@ class StyleTests : BaseMarkupTestFixture
style.Add(Label.TextColorProperty, Colors.Red);
- Assert.That(formsStyle.Setters.Count, Is.EqualTo(1));
+ Assert.That(formsStyle.Setters, Has.Count.EqualTo(1));
var setter = formsStyle.Setters[0];
@@ -146,7 +146,7 @@ class StyleTests : BaseMarkupTestFixture
(Label.TextColorProperty, Colors.Red),
(Label.TranslationXProperty, 8.0));
- Assert.That(formsStyle.Setters.Count, Is.EqualTo(2));
+ Assert.That(formsStyle.Setters, Has.Count.EqualTo(2));
var setter1 = formsStyle.Setters[0];
@@ -177,7 +177,7 @@ class StyleTests : BaseMarkupTestFixture
Assert.Multiple(() =>
{
- Assert.That(formsStyle.Behaviors.Count, Is.EqualTo(1));
+ Assert.That(formsStyle.Behaviors, Has.Count.EqualTo(1));
Assert.That(ReferenceEquals(formsStyle.Behaviors[0], behavior));
});
}
@@ -195,7 +195,7 @@ class StyleTests : BaseMarkupTestFixture
Assert.Multiple(() =>
{
- Assert.That(formsStyle.Behaviors.Count, Is.EqualTo(2));
+ Assert.That(formsStyle.Behaviors, Has.Count.EqualTo(2));
Assert.That(ReferenceEquals(formsStyle.Behaviors[0], behavior1));
Assert.That(ReferenceEquals(formsStyle.Behaviors[1], behavior2));
});
@@ -213,7 +213,7 @@ class StyleTests : BaseMarkupTestFixture
Assert.Multiple(() =>
{
- Assert.That(formsStyle.Triggers.Count, Is.EqualTo(1));
+ Assert.That(formsStyle.Triggers, Has.Count.EqualTo(1));
Assert.That(ReferenceEquals(formsStyle.Triggers[0], trigger));
});
}
@@ -231,7 +231,7 @@ class StyleTests : BaseMarkupTestFixture
Assert.Multiple(() =>
{
- Assert.That(formsStyle.Triggers.Count, Is.EqualTo(2));
+ Assert.That(formsStyle.Triggers, Has.Count.EqualTo(2));
Assert.That(ReferenceEquals(formsStyle.Triggers[0], trigger1));
Assert.That(ReferenceEquals(formsStyle.Triggers[1], trigger2));
});
diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/TypedBindingExtensionsTests.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/TypedBindingExtensionsTests.cs
index 9bc7872..0f57534 100644
--- a/src/CommunityToolkit.Maui.Markup.UnitTests/TypedBindingExtensionsTests.cs
+++ b/src/CommunityToolkit.Maui.Markup.UnitTests/TypedBindingExtensionsTests.cs
@@ -42,10 +42,9 @@ class TypedBindingExtensionsTests : BaseMarkupTestFixture
new Button()
.BindCommand(
(ViewModel vm) => vm.Command,
- new (Func, string)[]
- {
- (vm => vm, nameof(ViewModel.Command)),
- },
+ [
+ (vm => vm, nameof(ViewModel.Command))
+ ],
parameterGetter: _ => Colors.Black);
});
}
@@ -327,12 +326,11 @@ class TypedBindingExtensionsTests : BaseMarkupTestFixture
entry.BindingContext = viewmodel;
entry.Bind(Entry.TextColorProperty,
static (NestedViewModel vm) => vm.Model?.Model?.TextColor,
- new (Func, string)[]
- {
+ [
(vm => vm, nameof(NestedViewModel.Model)),
(vm => vm.Model, nameof(NestedViewModel.Model)),
(vm => vm.Model?.Model, nameof(NestedViewModel.Model.TextColor))
- },
+ ],
static (NestedViewModel vm, Color? color) =>
{
if (vm.Model?.Model?.TextColor is not null && color is not null)
@@ -346,12 +344,11 @@ class TypedBindingExtensionsTests : BaseMarkupTestFixture
{
entry.Bind(Entry.TextColorProperty,
static (NestedViewModel vm) => vm.Model?.Model?.TextColor,
- new (Func, string)[]
- {
+ [
(vm => vm, nameof(NestedViewModel.Model)),
(vm => vm.Model, nameof(NestedViewModel.Model)),
(vm => vm.Model?.Model, nameof(NestedViewModel.Model.TextColor))
- },
+ ],
static (NestedViewModel vm, Color? color) =>
{
if (vm.Model?.Model?.TextColor is not null && color is not null)
@@ -405,12 +402,11 @@ class TypedBindingExtensionsTests : BaseMarkupTestFixture
label.BindingContext = viewmodel;
label.Bind(Label.TextProperty,
static (NestedViewModel vm) => vm.Model?.Model?.TextColor,
- new (Func, string)[]
- {
+ [
(vm => vm, nameof(NestedViewModel.Model)),
(vm => vm.Model, nameof(NestedViewModel.Model)),
(vm => vm.Model?.Model, nameof(NestedViewModel.Model.TextColor))
- },
+ ],
static (NestedViewModel vm, Color? color) =>
{
if (vm.Model?.Model?.TextColor is not null && color is not null)
@@ -425,12 +421,11 @@ class TypedBindingExtensionsTests : BaseMarkupTestFixture
{
label.Bind(Label.TextProperty,
static (NestedViewModel vm) => vm.Model?.Model?.TextColor,
- new (Func, string)[]
- {
+ [
(vm => vm, nameof(NestedViewModel.Model)),
(vm => vm.Model, nameof(NestedViewModel.Model)),
(vm => vm.Model?.Model, nameof(NestedViewModel.Model.TextColor))
- },
+ ],
static (NestedViewModel vm, Color? color) =>
{
if (vm.Model?.Model?.TextColor is not null && color is not null)
diff --git a/src/CommunityToolkit.Maui.Markup.UnitTests/UnitExpressionSearch.cs b/src/CommunityToolkit.Maui.Markup.UnitTests/UnitExpressionSearch.cs
index 3ddf211..e4efc17 100644
--- a/src/CommunityToolkit.Maui.Markup.UnitTests/UnitExpressionSearch.cs
+++ b/src/CommunityToolkit.Maui.Markup.UnitTests/UnitExpressionSearch.cs
@@ -11,7 +11,7 @@ class UnitExpressionSearch : ExpressionVisitor, IExpressionSearch
public List FindObjects(Expression expression) where T : class
{
- results = new List();
+ results = [];
targeType = typeof(T);
Visit(expression);
return results.Select(o => o as T).ToList();
diff --git a/src/CommunityToolkit.Maui.Markup/FuncMultiConverter.cs b/src/CommunityToolkit.Maui.Markup/FuncMultiConverter.cs
index 122db65..f3ab8fa 100644
--- a/src/CommunityToolkit.Maui.Markup/FuncMultiConverter.cs
+++ b/src/CommunityToolkit.Maui.Markup/FuncMultiConverter.cs
@@ -127,7 +127,7 @@ public class FuncMultiConverter : FuncMultiConverter<
{
static T? To(object? value) => value != null ? (T)value : default;
- static object?[] ToObjects(ValueTuple values) => new object?[] { values.Item1, values.Item2 };
+ static object?[] ToObjects(ValueTuple values) => [values.Item1, values.Item2];
///
/// Initializes a new instance of .
@@ -157,7 +157,7 @@ public class FuncMultiConverter : FuncMulti
{
static T? To(object? value) => value != null ? (T)value : default;
- static object?[] ToObjects(ValueTuple values) => new object?[] { values.Item1, values.Item2, values.Item3 };
+ static object?[] ToObjects(ValueTuple values) => [values.Item1, values.Item2, values.Item3];
///
/// Initializes a new instance of .
@@ -189,7 +189,7 @@ public class FuncMultiConverter :
{
static T? To(object? value) => value != null ? (T)value : default;
- static object?[] ToObjects(ValueTuple values) => new object?[] { values.Item1, values.Item2, values.Item3, values.Item4 };
+ static object?[] ToObjects(ValueTuple values) => [values.Item1, values.Item2, values.Item3, values.Item4];
///
/// Initializes a new instance of .
@@ -220,7 +220,7 @@ public class FuncMultiConverterWithParam : Fu
{
static T? To(object? value) => value != null ? (T)value : default;
- static object?[] ToObjects(ValueTuple values) => new object?[] { values.Item1, values.Item2 };
+ static object?[] ToObjects(ValueTuple values) => [values.Item1, values.Item2];
///
/// Initializes a new instance of .
@@ -251,7 +251,7 @@ public class FuncMultiConverterWithParam(object value) => value != null ? (T)value : default;
- static object?[] ToObjects(ValueTuple values) => new object?[] { values.Item1, values.Item2, values.Item3 };
+ static object?[] ToObjects(ValueTuple values) => [values.Item1, values.Item2, values.Item3];
///
/// Initializes a new instance of .
@@ -284,7 +284,7 @@ public class FuncMultiConverterWithParam(object? value) => value != null ? (T)value : default;
- static object?[] ToObjects(ValueTuple values) => new object?[] { values.Item1, values.Item2, values.Item3, values.Item4 };
+ static object?[] ToObjects(ValueTuple values) => [values.Item1, values.Item2, values.Item3, values.Item4];
///
/// Initializes a new instance of .
diff --git a/src/CommunityToolkit.Maui.Markup/GesturesExtensions.TypedBindings.cs b/src/CommunityToolkit.Maui.Markup/GesturesExtensions.TypedBindings.cs
index a4c8ff2..79715c6 100644
--- a/src/CommunityToolkit.Maui.Markup/GesturesExtensions.TypedBindings.cs
+++ b/src/CommunityToolkit.Maui.Markup/GesturesExtensions.TypedBindings.cs
@@ -54,7 +54,7 @@ public static partial class GesturesExtensions
return BindClickGesture(
gestureElement,
getterFunc,
- new (Func, string)[] { ((TCommandBindingContext b) => b, GetMemberName(getter)) },
+ [((TCommandBindingContext b) => b, GetMemberName(getter))],
setter,
source,
commandBindingMode,
@@ -167,7 +167,7 @@ public static partial class GesturesExtensions
return BindSwipeGesture(
gestureElement,
getterFunc,
- new (Func, string)[] { ((TCommandBindingContext b) => b, GetMemberName(getter)) },
+ [((TCommandBindingContext b) => b, GetMemberName(getter))],
setter,
source,
commandBindingMode,
@@ -280,7 +280,7 @@ public static partial class GesturesExtensions
return BindTapGesture(
gestureElement,
getterFunc,
- new (Func, string)[] { ((TCommandBindingContext b) => b, GetMemberName(getter)) },
+ [((TCommandBindingContext b) => b, GetMemberName(getter))],
setter,
source,
commandBindingMode,
diff --git a/src/CommunityToolkit.Maui.Markup/TypedBindingExtensions.cs b/src/CommunityToolkit.Maui.Markup/TypedBindingExtensions.cs
index 5dd2cdd..69d8537 100644
--- a/src/CommunityToolkit.Maui.Markup/TypedBindingExtensions.cs
+++ b/src/CommunityToolkit.Maui.Markup/TypedBindingExtensions.cs
@@ -191,7 +191,7 @@ public static partial class TypedBindingExtensions
bindable,
targetProperty,
getterFunc,
- new (Func, string)[] { ((TBindingContext b) => b, GetMemberName(getter)) },
+ [((TBindingContext b) => b, GetMemberName(getter))],
setter,
mode,
convert,
@@ -223,7 +223,7 @@ public static partial class TypedBindingExtensions
bindable,
targetProperty,
getterFunc,
- new (Func, string)[] { ((TBindingContext b) => b, GetMemberName(getter)) },
+ [((TBindingContext b) => b, GetMemberName(getter))],
setter,
mode,
converter,