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 (New{x.testid,x.testname}). Select (new Teamdto () {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

Related Article

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.