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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:04:16+00:00 2026-06-14T09:04:16+00:00

form.myDataTable.Rows[i][2 * cs] = corr; form.myDataTable.Rows[i][2 * cs + 1] = p + Convert.ToString(col1)

  • 0
form.myDataTable.Rows[i][2 * cs] = corr;                
form.myDataTable.Rows[i][2 * cs + 1] = "p" + Convert.ToString(col1) 
                                        + " p" + Convert.ToString(col2);

I need to sort 2*cs column by values and also corresponding names in column 2*cs+1.

I am trying like this:

var corrvalues = new Dictionary(); 
correlationvalues["p" + Convert.ToString(col1) 
                      + " p" + Convert.ToString(col2)] = corr;
sortedvalues = correlationvalues.Values.OrderByDescending;

I am not clear how to use orderbydescending, i am new to c#. Thanks for help.

  • 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-14T09:04:17+00:00Added an answer on June 14, 2026 at 9:04 am

    OrderByDescending is a function, not a property. It has one required parameter, which is a function that takes a value in the collection (in your case, correctionvalues.Values) and returns a “key” to use for comparison purposes. If you just want to compare directly on the values themselves, you can pass in an identity lambda function (e.g. x => x).

    var corrvalues = new Dictionary(); 
    correlationvalues["p" + Convert.ToString(col1) 
                          + " p" + Convert.ToString(col2)] = corr;
    sortedvalues = correlationvalues.Values.OrderByDescending(val => val);
    

    If your values are more complex types (such as a Person class) and you want to sort on a particular field (such as Name), then you could pass in something like this:

    sorted = personDict.Values.OrderByDescending(person => person.Name);
    

    See http://msdn.microsoft.com/en-us/library/system.linq.enumerable.orderbydescending.aspx for more detail on OrderByDescending.

    You can also learn more about lambda expressions (which is useful if you’re new to C#) here: http://msdn.microsoft.com/en-us/library/bb397687.aspx

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

Sidebar

Related Questions

Form is made from a function that prints out all rows that are awaiting
Form this question ( ETag vs Header Expires ) i understood that i need
form html: <form action='/register/' method = 'post'>{% csrf_token %} ... <label>Avatar: </label><input type='file' name='avatar'
Form docs: Comparable c=mock(Comparable.class); when(c.compareTo(anyInt())).thenReturn(-1); I would like: File tempDir=new File(test); Comparable c=mock(Comparable.class); when(c.compareTo(anyInt())).thenReturn(tempDir.mkdir());
Form is not giving value on controller for sql.date i am using spring and
Form has the DoubleBuffered property (bool, inherited from Control). If this is set to
The form has one or more groups of radio buttons on it. It is
My form has issues with latin characters (portuguese). If the user submitted his info
InfoPath form web part can be used to fill out a published InfoPath form
Windows form application(.Net 3.5) I have a textbox and a button on the form.

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.