C # Tips for solving LINQ-to-be () failures

Source: Internet
Author: User

Objective

I used LINQ GroupBy and by-numbers in a data list a few days ago. Sorting in the normal use of the machine, sent to the test after the sort of death, is depressed, always thought to be a procedural problem. So I consulted another colleague. The answer is as follows.

Problem Causes and Solutions

Because the server is installed in the English version of the operating system, there is no Chinese package, so encountered in the Chinese sort is not recognized, so the use of the order must be handled separately.

CultureInfo Culture = Cultureinfo.getcultureinfo ("ZH-CN"); List<TeamDto> Teamdtos =teams. GroupBy (x=New{x.testid, x.testname}) . Select (g=Newteamdto () {TestID=G.key.testid, Test=G.key.testname, Teams=g.tolist ()}) . (T=>t.test,stringcomparer.create (Culture,true))                    . ToList ();

C # Tips for solving LINQ-to-be () failures

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.