diff --git a/src/Umbraco.Core/Collections/CompositeTypeTypeKey.cs b/src/Umbraco.Core/Collections/CompositeTypeTypeKey.cs
index 07c9a8ded2..1a4e7ae1a9 100644
--- a/src/Umbraco.Core/Collections/CompositeTypeTypeKey.cs
+++ b/src/Umbraco.Core/Collections/CompositeTypeTypeKey.cs
@@ -10,7 +10,7 @@ namespace Umbraco.Core.Collections
///
/// Initializes a new instance of the struct.
///
- public CompositeTypeTypeKey(Type type1, Type type2)
+ public CompositeTypeTypeKey(Type type1, Type type2) : this()
{
Type1 = type1;
Type2 = type2;
@@ -19,26 +19,35 @@ namespace Umbraco.Core.Collections
///
/// Gets the first type.
///
- public Type Type1 { get; }
+ public Type Type1 { get; private set; }
///
/// Gets the second type.
///
- public Type Type2 { get; }
+ public Type Type2 { get; private set; }
///
public bool Equals(CompositeTypeTypeKey other)
- => Type1 == other.Type1 && Type2 == other.Type2;
+ {
+ return Type1 == other.Type1 && Type2 == other.Type2;
+ }
///
public override bool Equals(object obj)
- => obj is CompositeTypeTypeKey other && Type1 == other.Type1 && Type2 == other.Type2;
+ {
+ var other = obj is CompositeTypeTypeKey ? (CompositeTypeTypeKey)obj : default(CompositeTypeTypeKey);
+ return Type1 == other.Type1 && Type2 == other.Type2;
+ }
public static bool operator ==(CompositeTypeTypeKey key1, CompositeTypeTypeKey key2)
- => key1.Type1 == key2.Type1 && key1.Type2 == key2.Type2;
+ {
+ return key1.Type1 == key2.Type1 && key1.Type2 == key2.Type2;
+ }
public static bool operator !=(CompositeTypeTypeKey key1, CompositeTypeTypeKey key2)
- => key1.Type1 != key2.Type1 || key1.Type2 != key2.Type2;
+ {
+ return key1.Type1 != key2.Type1 || key1.Type2 != key2.Type2;
+ }
///
public override int GetHashCode()
diff --git a/src/Umbraco.Tests.Benchmarks/ConcurrentDictionaryBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/ConcurrentDictionaryBenchmarks.cs
index 6cb39b7235..4e8476bb6d 100644
--- a/src/Umbraco.Tests.Benchmarks/ConcurrentDictionaryBenchmarks.cs
+++ b/src/Umbraco.Tests.Benchmarks/ConcurrentDictionaryBenchmarks.cs
@@ -37,7 +37,8 @@ namespace Umbraco.Tests.Benchmarks
{
// This method is 10% faster
var key = new CompositeTypeTypeKey(source, target);
- if (AssignableTypeCache.TryGetValue(key, out bool canConvert))
+ bool canConvert;
+ if (AssignableTypeCache.TryGetValue(key, out canConvert))
{
return canConvert;
}
diff --git a/src/Umbraco.Web/PublishedContentQuery.cs b/src/Umbraco.Web/PublishedContentQuery.cs
index 469d53f749..6cd130af0a 100644
--- a/src/Umbraco.Web/PublishedContentQuery.cs
+++ b/src/Umbraco.Web/PublishedContentQuery.cs
@@ -241,8 +241,10 @@ namespace Umbraco.Web
var tmpNodes = cache.GetXPathNavigator().Select("//*[@nodeTypeAlias]");
foreach (XPathNavigator tmpNode in tmpNodes)
{
- if (int.TryParse(tmpNode.GetAttribute("id", string.Empty), out int tmpNodeId)
- && Guid.TryParse(tmpNode.GetAttribute("key", string.Empty), out Guid tmpNodeKey))
+ int tmpNodeId;
+ Guid tmpNodeKey;
+ if (int.TryParse(tmpNode.GetAttribute("id", string.Empty), out tmpNodeId)
+ && Guid.TryParse(tmpNode.GetAttribute("key", string.Empty), out tmpNodeKey))
{
_guidToIntLoopkup[tmpNodeKey] = tmpNodeId;
}
@@ -252,8 +254,9 @@ namespace Umbraco.Web
IPublishedContent doc;
- // Check if the lookup contains the GUID/INT value
- if (_guidToIntLoopkup.TryGetValue(id, out int nodeId) == false)
+ // Check if the lookup contains the GUID/INT value
+ int nodeId;
+ if (_guidToIntLoopkup.TryGetValue(id, out nodeId) == false)
{
// If not, then we perform an inefficient XPath for the GUID
@@ -460,4 +463,4 @@ namespace Umbraco.Web
#endregion
}
-}
\ No newline at end of file
+}