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

  • SEARCH
  • Home
  • 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 8647421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:04:01+00:00 2026-06-12T13:04:01+00:00

I am attempting to get some custom objects from the CollectionChanged event of a

  • 0

I am attempting to get some custom objects from the CollectionChanged event of a collection which implements INotifyCollectionChanged.

MyControl_MyCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
  if(e.Action == NotifyCollectionChangedAction.Add)
  {
    lock(e.NewItems.SyncRoot)
    {
      var myItems = e.NewItems.OfType<MyType>();

      if(myItems.Any())
      {
        //do stuff
      }
    }
  }
}

The problem I am facing is that myItems always says “Enumeration yielded no results”.

Expanding on debug e.NewItems.SyncRoot shows the following:

e.NewItems.SyncRoot | {object[1]}
|-[0] | {System.Linq.Enumerable.WhereSelectListIterator<MyType, IMyInterface>}
| |-base ...
| |-Non-public members
| |-Results View | Expanding the Results View...
|   |-[0] | MyType

So clearly the data is there. What is the method for retrieving this data?

  • 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-12T13:04:02+00:00Added an answer on June 12, 2026 at 1:04 pm

    This looks like a bug in whatever is creating the NotifyCollectionChangedEventArgs object.

    NotifyCollectionChangedEventArgs has several constructors. There are two relevant ones here:

    • NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction, object)
    • NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction, IList)

    The first describes a change on a single item. The second describes a change on a list of items.

    However, the NotifyCollectionChangedEventArgs constructor has been called as new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, enumerable). IEnumerable<...> does not implement IList, so the first constructor gets called when the second is the one that should be used.

    Do you have control over the code that raises NotifyCollectionChanged? If so, use new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, enumerable.ToList()) instead.

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

Sidebar

Related Questions

I am attempting to get some information from a website, the info that I
I am attempting to get some information from a russian shipping website. Being a
I am attempting to use ASIHttpRequest with the iPhone to get some information from
I am attempting to create some custom map routes but can't get it working
I'm attempting to Serialize my custom collection UserDataCollection, made out of UserData objects. I
Im attempting to get some records from a table based on certain factors. One
Im attempting to get a block of text from a file I have already
I'm attempting to get order data from a Yahoo store. I'm using the docs
Currently attempting to get some code to compile using Lejos for the Lego NXT
Im attempting to utilize some custom script and css files within an asp page.

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.