diff --git a/framework-dotnet/src/lib/MBS.Core/Collections/Generic/ExtensionMethods.cs b/framework-dotnet/src/lib/MBS.Core/Collections/Generic/ExtensionMethods.cs index 0b58403..fbe1f43 100755 --- a/framework-dotnet/src/lib/MBS.Core/Collections/Generic/ExtensionMethods.cs +++ b/framework-dotnet/src/lib/MBS.Core/Collections/Generic/ExtensionMethods.cs @@ -62,6 +62,13 @@ namespace MBS.Core.Collections.Generic list.Add(item); } } + public static void AddRange(this ICollection> list, IEnumerable> items) + { + foreach (KeyValuePair kvp in items) + { + list.Add(kvp); + } + } public static T[] ToNullTerminatedArray(this IEnumerable enumerable) where T : class { diff --git a/framework-dotnet/src/lib/MBS.Core/Reflection/TypeLoader.cs b/framework-dotnet/src/lib/MBS.Core/Reflection/TypeLoader.cs index 4aa052e..acdfefa 100644 --- a/framework-dotnet/src/lib/MBS.Core/Reflection/TypeLoader.cs +++ b/framework-dotnet/src/lib/MBS.Core/Reflection/TypeLoader.cs @@ -129,12 +129,12 @@ public class TypeLoader } private static Type[] mvarAvailableTypes = null; - public static T[] GetAvailableTypes(Assembly[] additionalAssemblies = null) where T : class + public static T[] GetAvailableTypes(Assembly[] additionalAssemblies = null, bool resetCache = false) where T : class { Type[] ts = null; try { - ts = GetAvailableTypes(new Type[] { typeof(T) }, additionalAssemblies); + ts = GetAvailableTypes(new Type[] { typeof(T) }, additionalAssemblies, resetCache); } catch (ReflectionTypeLoadException ex) { @@ -156,8 +156,12 @@ public class TypeLoader } return list.ToArray(); } - public static Type[] GetAvailableTypes(Type[] inheritsFrom = null, Assembly[] additionalAssemblies = null) + public static Type[] GetAvailableTypes(Type[] inheritsFrom = null, Assembly[] additionalAssemblies = null, bool resetCache = false) { + if (resetCache) + { + mvarAvailableTypes = null; + } if (mvarAvailableTypes == null) { List types = new List(); @@ -210,6 +214,7 @@ public class TypeLoader List retval = new List(); foreach (Type t in mvarAvailableTypes) { + string typeFullName = t.FullName; foreach (Type inheritsFromType in inheritsFrom) { if (t.FullName.Contains("Mini."))