public static Type GetBehaviorInterface(this Type behaviorType) { return behaviorType.GetInterfaces() .First(x => x.IsGenericType && x.GetGenericTypeDefinition() == BehaviorInterfaceType); }