C#C
C#3y ago
CTJ

❔ Cannot convert lambda expression to type 'Activity' because it is not a delegate type error

So I want to check if List contains element with todays date but tis error occurs:
CS1660 Cannot convert lambda expression to type 'Activity' because it is not a delegate type

Here is definition of class:
public class MemberStats
{
    [BsonElement("userID")]
    public ulong UserId { get; set; }

    [BsonElement("Activity")]
    public List<Activity> MessagesPerDay { get; set; }
}

public class Activity
{
    public DateTime Day { get; set; }
    public int Messages { get; set; }
}


and here is where error occurs:
 if (Stats.MessagesPerDay.Contains(act => act.Date == DateTime.Today))
 {

 }

I have no idea what delegate means so9 any help would be appericiated!
image.png
image.png
Was this page helpful?