Skip to content

Commit

Permalink
Cleanup DefaultDropHandler.TestCompatibleTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
dauthleikr authored and punker76 committed Dec 4, 2019
1 parent 2a34b41 commit f651544
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/GongSolutions.WPF.DragDrop/DefaultDropHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,13 @@ protected static bool IsChildOf(UIElement targetItem, UIElement sourceItem)

protected static bool TestCompatibleTypes(IEnumerable target, object data)
{
TypeFilter filter = (t, o) => { return (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IEnumerable<>)); };
bool InterfaceFilter(Type t, object o) => (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IEnumerable<>));

var enumerableInterfaces = target.GetType().FindInterfaces(filter, null);
var enumerableInterfaces = target.GetType().FindInterfaces(InterfaceFilter, null);
var enumerableTypes = from i in enumerableInterfaces
select i.GetGenericArguments().Single();

if (enumerableTypes.Count() > 0)
if (enumerableTypes.Any())
{
var dataType = TypeUtilities.GetCommonBaseClass(ExtractData(data));
return enumerableTypes.Any(t => t.IsAssignableFrom(dataType));
Expand Down

0 comments on commit f651544

Please sign in to comment.