LINQ----1

Source: Internet
Author: User

student[] StAry ={                              NewStudent ("Zhang San","male", -),                              NewStudent ("Xiao Ming","male", -),                              NewStudent ("Lili","female", -),                              NewStudent ("Xiao Ju","female", -),                              NewStudent ("Zhang Si","male", -),                              NewStudent ("Zhang Eight","male", -),                          }; varQuery1 = fromVallinchStArySelectVall; foreach(Student StinchQuery1)            System.Console.WriteLine (ST); varQuery2 = fromVal2inchStArySelectVal2.            Age; foreach(varAgeinchQuery2) {System.Console.WriteLine ("{0}", age); }            varQuery3 = fromVal2inchStArySelectVal2.            Name.length; foreach(varNameinchquery3)            {System.Console.WriteLine (name); }
View Code

Where to use:

int[] ary = {1,3,9, A, the, A, -, -, the, $, + }; varQuery1 = fromVal1incharywhereVal1 > the SelectVal1; foreach(varValinchQuery1) System.Console.WriteLine (val);

Usage by:

Student [] stary=            {                 NewStudent ("Wangxiao","male", -),                 NewStudent ("Chang Buri Rate Army","male", A),                  NewStudent ("Xu Xian Yu Yu","male", A),                  NewStudent ("a flower","female", -),            }; varQuery1 = fromVal1inchStary byVal1. AgeSelectVal1; foreach(varStinchQuery1) {System.Console.WriteLine ("{0}--{1}--{2}", St. Name, St. Xingbie, St.            Age); }

The default is ascending, ascending, and can be set to descending desending.

Multiple keywords can be specified

If more than one is present in the same query, only the last one is valid. The effect differs from where's fetch-set.

GROUP BY group:

varQuery1 = fromStinchStary Group St by St.            Xingbie; foreach(varGrpinchQuery1) {System.Console.WriteLine (GRP.                Key); foreach(varStuinchGRP)                {System.Console.WriteLine (STU); }            }            varQuery2 = fromStinchStary Group St by St. Age to Stgrp_ageSelectStgrp_age; foreach(varAgeinchQuery2) {System.Console.WriteLine (age. Key+":"); foreach(varStuinchAge )                {System.Console.WriteLine (STU); }            }

LINQ----1

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.