Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8863715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:03:09+00:00 2026-06-14T16:03:09+00:00

I stumbled across this very strange compiler behavior. I am trying to remove items

  • 0

I stumbled across this very strange compiler behavior. I am trying to remove items from ObservableCollection based on some condition. Here is what I have in my code which throws error

public ObservableCollection<StandardContact> StandardContacts { get; set; }
....
StandardContacts.Remove(s => s.IsMarked); //Compiler Error

The error is as follows

Error Cannot convert lambda expression to type 'RelayAnalysis_Domain.Entity.StandardContact' because it is not a delegate type  

Surprisingly, the code below in the same method works

var deleteCount = StandardContacts.Where(s => s.IsMarked).Count(); //This Works

I already have following imports in my class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Entity;

This question may turnout to be silly, but it has had my head scratching.

Note: Even the Intellisence shows the same error

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:03:10+00:00Added an answer on June 14, 2026 at 4:03 pm

    As the error message unclearly states, you can’t do that.
    ObservableCollection<T> does not have a method that removes items that match a condition. (unlike List<T>, which has RemoveAll())

    Instead, you can loop backwards through the collection and call Remove().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to truncate some text in PHP and have stumbled across this method
I stumbled across this article and found it very interesting, so I ran some
I'm currently writing a socket program in C++ and I've stumbled across very strange
I'm refactoring some code that a friend wrote and recently stumbled across this function:
I've stumbled across a very strange bug. I'm using jQuery scrollTop to let the
I stumbled across this problem in F#. Suppose, I want to declare two types
I stumbled across this C code today. Can anyone tell me what the 'where'
I'm currently learning Ruby and RoR and I stumbled across this declaration: link_to_remote(name, options
I need to add indexes to my table (columns) and stumbled across this post:
So, poking through the n869 draft of the C99 standard I stumbled across this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.