diff --git a/src/CoreLibrary/Assets/Scripts/CoreLibrary/Base/UtilityExtensions.cs b/src/CoreLibrary/Assets/Scripts/CoreLibrary/Base/UtilityExtensions.cs
index f40e850..d31896b 100644
--- a/src/CoreLibrary/Assets/Scripts/CoreLibrary/Base/UtilityExtensions.cs
+++ b/src/CoreLibrary/Assets/Scripts/CoreLibrary/Base/UtilityExtensions.cs
@@ -7,7 +7,7 @@
namespace CoreLibrary
{
///
- /// Author: Cameron Reuschel
+ /// Author: Cameron Reuschel, Daniel Götz
///
/// The class holding all nonspecific extension methods in the core library.
///
@@ -159,5 +159,40 @@ public static IEnumerable Shuffled(this IEnumerable l, System.Random ra
return list;
}
+
+ //===========================
+ //===== MISC EXTENSIONS =====
+ //===========================
+
+ #if UNITY_2018_3_OR_NEWER
+
+ ///
+ /// This feature is available from C#7 and upwards. It can be used by developers
+ /// using Unity 2018.3 or newer with the Scripting Runtime Version 4.x or higher.
+ /// This method allows KeyValuePairs to be deconstructed into tuples implicitly.
+ /// In most cases, this function does not even have to be called directly.
+ ///
+ ///
+ /// var myKvp = new KeyValuePair<int,int>();
+ /// // ...
+ /// var (key, value) = myKvp; // This was not possible before
+ ///
+ /// This is really useful in foreach loops iterating over dictionaries
+ ///
+ /// var myDict = new Dictionary<int,int>();
+ /// // ...
+ /// foreach(var (key, value) in myDict) // This was also not possible
+ /// {
+ /// // ...
+ /// }
+ ///
+ ///
+ ///
+ public static void Deconstruct(this KeyValuePair kvp, out TKey key, out TValue value) {
+ key = kvp.Key;
+ value = kvp.Value;
+ }
+
+ #endif
}
}
\ No newline at end of file