[RESOLVED]does not contain a definition for 'Any'

I am creating a method for a piece of code that I intend to re-use.  The code works as part of a cshtml file, but when I move it into a method get this error message:

system.collections.generic.IEnumberable<dynamic> does not contain a definition for Any and no extension method Any

using System;
using System.Collections.Generic;
using System.Web;
using WebMatrix.Data;


/// <summary>
/// 
/// </summary>
public static class CalendarCleanUp
{
    public static CalendarCleanUp(int providerid)
    {
    var db = Database.Open("StarterSite");
    int thisweekno = DateUtils.GetWeekNo(DateTime.Now);
    bool haschanged = false;
    bool isactive = true;
    var records = db.Query("SELECT calRId, weekNo, WeekSelectionId FROM calRecords cr JOIN TimeSelections ts ON cr.calWId = ts.WeekSelectionId WHERE ProviderId=@0 AND isActive=@1", providerid, true);
    if (records.Any())
        {

In Visual Studio I can sometimes find what it need by hitting ALT SHFT F10, but that doesn’t work here.

Add 

using System.Linq;

to the top of the file.

thanks.

Leave a Reply