In C#, currently i'm doing the following code to filter out a specific set of classes that inherit from the CaptureType that is passed to the method.
public static CaptureType[] ListPluginsWith<CaptureType>()
{
List<CaptureType> plugins = new List<CaptureType>();
foreach (var plugin in Bot.AutoPlugins)
{
CaptureType plug;
try
{
if ((plug = (CaptureType)plugin.Interface) != null)
{
plugins.Add(plug);
}
}
catch
{
//doesn't inherit
}
}
return plugins.ToArray();
}
is there a more efficient/better/faster way to do this? if so, please let me know :)