// ------------------------------------------------------------------------ // Copyright (c) 2021-2026, Jiaqi (0x7c13) Liu. All rights reserved. // See LICENSE file in the project root for license information. // ------------------------------------------------------------------------ namespace Pal3.Core.Extensions { using System.Collections.Generic; public static class DictionaryExtensions { public static Dictionary Reverse(this IDictionary source) { Dictionary dictionary = new (); foreach (KeyValuePair entry in source) { dictionary.TryAdd(entry.Value, entry.Key); } return dictionary; } } }