This is a migrated thread and some comments may be shown as answers.

Drag Drop 'OfType' error

1 Answer 22 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Brett
Top achievements
Rank 1
Brett asked on 12 Mar 2013, 10:34 PM
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.

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 15 Mar 2013, 09:12 AM
Hi Brett,

You just need to add the following namespace:

using System.Linq;

Hope this helps.

Greetings,
Yana
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ScheduleView
Asked by
Brett
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or