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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:46:09+00:00 2026-06-06T04:46:09+00:00

I have got: var orderedStatItmes = item.Statistics.OrderByDescending(t=>t.StartTime); Note that public BindingList<IStatistics> Statistics { set;

  • 0

I have got:

var orderedStatItmes = item.Statistics.OrderByDescending(t=>t.StartTime); 

Note that

public BindingList<IStatistics> Statistics { set; get; }

What I need is the best way to reassign orderedStatItmes to item.Statistics so it should be in place.

How to do it?

Thanks!!

  • 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-06T04:46:11+00:00Added an answer on June 6, 2026 at 4:46 am

    I can’t say I’ve used BindingList<T> much at all myself.

    You may be better off sorting the underlying collection, if you’ve got access to that. Alternatively, if the BindingList<T> itself supports sorting, you might want to use IBindingList.ApplySort.

    One horribly hacky way of doing it would be:

    var ordered = item.Statistics.OrderByDescending(t => t.StartTime).ToList();
    for (int i = 0; i < ordered.Count; i++)
    {
        item.Statistics[i] = ordered[i];
    }
    

    … but I wouldn’t like to say what that will do to any bindings while it’s updating.


    Old answer (before question was edited to mention BindingList<T>)

    Do you mean you need to mutate the existing array, or are you happy to just assign a new array reference to the item.Statistics property? If it’s the latter:

    item.Statistics = item.Statistics.OrderByDescending(t=>t.StartTime).ToArray();
    

    If you want to basically sort the array (I’m assuming it’s an array, based on your question title) in place, you could use:

    Array.Sort(item.Statistics, (x, y) => x.StartTime.CompareTo(y.StartTime));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got entity: Entry { public virtual ICollection<Content> Contents { get; set; }
I have got a modal window set-up on my page that works fine, but
I have got code like this var challegneListener; $(document).ready(function(){ var challegneListener = setInterval(challengeListenerBot(),5000); });
I have got the following very simple code: function init() { var articleTabs =
I have got a field in mysql table with the type SET and collation
I have got 2 javascript variables: var list1 = john doe|bill williams|poll bregg|michael jordan;
I have got an IEnumerable collection as follows var result1 = GetResult1() // Returns
I have got this controller: class Start extends CI_Controller{ var $base; var $css; function
I have got jquery post function jQuery('.more-button').live('click', function(eve){ var page = jQuery(this).attr('id').replace('more-button-',''); loaded_messages +=
I have got the following code that produce an image. But I'm getting the

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.