Drag Drop 'OfType' error

2 posts, 0 answers
  1. Brett
    Brett avatar
    13 posts
    Member since:
    Jan 2012

    Posted 12 Mar 2013 Link to this post

    public class ScheduleViewDragDropBehavior : Telerik.Windows.Controls.ScheduleViewDragDropBehavior
            public override IEnumerable<IOccurrence> ConvertDraggedData(object data)
                if (DataObjectHelper.GetDataPresent(data, typeof(Appointment), false))
                    return ((IEnumerable)DataObjectHelper.GetData(data, typeof(Appointment), false)).OfType<IOccurrence>();
                return base.ConvertDraggedData(data);

    The following line of code is giving me an error:
    return ((IEnumerable)DataObjectHelper.GetData(data, typeof(Appointment), false)).OfType<IOccurrence>();

    This is the error:
    System.Collections.IEnumerable does not contain a definition for 'OfType' and no extension method 'OfType' accepting a first argument of type 'System.Collections.IEnumerable' could be found (are you missing a using directive or an assembly reference?) C:\BRPlanner\BRP\Planner\ScheduleViewDragDropBehavior.cs 24 98 Planner

    What do I need to do to create an extension method for 'OfTYpe'

    Thank you.
  2. Yana
    Yana avatar
    4547 posts

    Posted 15 Mar 2013 Link to this post

    Hi Brett,

    You just need to add the following namespace:

    using System.Linq;

    Hope this helps.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
Back to Top