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 5976525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:14:29+00:00 2026-05-22T21:14:29+00:00

Andrew Davies created an excellent little class on sourceforge called BindingListView<T> which essentially allows

  • 0

Andrew Davies created an excellent little class on sourceforge called BindingListView<T> which essentially allows you to bind a collection to a DataGridView while supporting sorting and filtering. Binding a DataGridView to a normal List<T> does not support sorting and filtering, as the proper interfaces are not implemented by List<T>.

The class works great and has solved my UI problems. However, it’d be awesome if I could iterate through the collection using LINQ, but I’m just not sure how to set it up to do so. Source code can be downloaded here. Can anyone help me out?

  • 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-05-22T21:14:29+00:00Added an answer on May 22, 2026 at 9:14 pm

    Because the BindingListView<T> project uses .NET Framework v2.0 and predates LINQ, it doesn’t expose an IEnumerable<T> for you to query on. Since it does implement non-generic IEnumerable and non-generic IList, you can use Enumerable.Cast<TResult> to convert the collection into a form suitable for use with LINQ. However, this approach isn’t that helpful because the IEnumerable that AggregateBindingListView<T> returns is an internal data structure with type KeyValuePair<ListItemPair<T>, int>.

    To upgrade this project for convenient use with LINQ, the simplest approach might be to implement IEnumerable<T> on AggregateBindingListView<T>. First add it to the declaration of the class:

    public class AggregateBindingListView<T> : Component, IBindingListView, IList, IRaiseItemChangedEvents, ICancelAddNew, ITypedList, IEnumerable<T>
    

    and then implement it at the end of the class definition:

    #region IEnumerable<T> Members
    
    IEnumerator<T> IEnumerable<T>.GetEnumerator()
    {
        for (int i = 0; i < _sourceIndices.Count; i++)
            yield return _sourceIndices[i].Key.Item.Object;
    
    }
    
    #endregion
    

    and now you can use LINQ directly on a BindingListView<T> instance like this:

    // Create a view of the items
    itemsView = new BindingListView<Item>(feed.Items);
    var descriptions = itemsView.Select(t => t.Description);
    

    Remember to upgrade all the projects from .NET Framework v2.0 to .NET Framework 4 Client Profile and add using System.Linq; in order for this to work with your current project.

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

Sidebar

Related Questions

Updated question given Andrew Hare's correct answer: Given the following C# classes: public class
I was recommeded a book called: Accelerated C++ Practical Programming by Example by Andrew
Andrew Davey created a very nice library to allow on the fly minification and
I have used Andrew's modified Reachability class. -(void)viewDidLoad [[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self
PROBLEM SOLVED. Special thanks to Andrew Noyes for explaining its not a class but
var thename = 'Andrew'; db.collection.find({'name':thename}); How do I query case insensitive? I want to
I was reading Andrew Kennedy's blog post series on units of measurement in F#
In my previous question , Andrew Jaffe writes : In addition to all of
I'm reading the book ASP.NET 3.5 Social Networking - Andrew Siemer and I got
INSERT INTO tblExcel (ename, position, phone, email) VALUES ('Burton, Andrew', 'Web Developer / Network

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.