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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:40:44+00:00 2026-05-10T20:40:44+00:00

Previously, I had a class that wrapped an internal System.Collections.Generic.List<Item> (where Item is a

  • 0

Previously, I had a class that wrapped an internal System.Collections.Generic.List<Item> (where Item is a class I created). The wrapper class provided several collection-level properties that provided totals, averages, and other computations on items in the list. I was creating a BindingSource around this wrapped List<> and another BindingSource around my class and was able to get at the Items in the wrapped list through the first BindingSource and the collection-level properties of the wrapper class using the second.

A simplified example looks like:

public class OldClass() {   private List<Item> _Items;    public OldClass()   {     _Items = new List<Item>();   }    public List<Item> Items { get { return _Items; } }    // collection-level properties   public float AverageValue { get { return Average() } }   public float TotalValue { get { return Total() } }   // ... other properties like this  } 

With the binding sources created in this way:

_itemsBindingSource = new BindingSource(oldClass.Items); _summaryBindingSource = new BindingSource(oldClass); 

Recently, I tried to change this class to be derived from System.Collections.Generic.List<Item> instead of keeping a wrapped List<> member. My hope was to get rid of the extra wrapper layer and use only one BindingSource instead of two. However, now I find that I cannot get at the properties that apply to all items in the list (such as AverageValue) when I do data binding. Only the properties of list items are available.

Am I forced to go back to using a wrapped List<> of Items? Or is there a way that I can get at both the properties of Items stored my new class as well as the properties that apply to the collection itself?

  • 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. 2026-05-10T20:40:45+00:00Added an answer on May 10, 2026 at 8:40 pm

    The system treats anything that implements IList (or IListSource) as a container, rather than an item. As such, you cannot bind to properties of anything that implements IList. As such, encapsulation (i.e. what you already have) is the best approach if you want to be able to bind to properties of the container.

    However, you should note that many bindings support dot-notation in the source – i.e. either binding to ‘Items.SomeProperty’, or setting the auxiliary property (typically DataMember) to specify sub-lists.

    This allows you to have a single BindingSource, and have different controls bound to different levels in the hierarchy – i.e. you might have a TextBox bound to AverageValue, and a DataGridView (with the same DataSource) that has DataMember='Items'.

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

Sidebar

Ask A Question

Stats

  • Questions 65k
  • Answers 65k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Fundamentally, WCF messages are XML, since the S.S.C.Message class uses… May 11, 2026 at 11:14 am
  • added an answer Use the ob_get_level() function to see if an output buffer… May 11, 2026 at 11:13 am
  • added an answer What does he use -- std::string only? Does he know… May 11, 2026 at 11:13 am

Related Questions

Previously, I had a class that wrapped an internal System.Collections.Generic.List<Item> (where Item is a
On my previous machine I had IIS6 installed and created a web project using
This is a follow-up to a previous question I had about interfaces. I received
I recently had to work on a project where the previous developer modified the
I was looking for an answer for a previous question and had an ingenious
Previously, I asked the question . The problem is the demands of our file
Previously I have asked to strip text from a field and convert it to
Previously I've asked about inserting a column into a dataset . I now have
When I asked this previously I should have mentioned that it's particularly a light-weight
I previously asked a question regarding MX records (and appreciate the thoughtful answers I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.