C # LINQ (5)

Source: Internet
Author: User

What is the single data gap that is being said, and what if multiple data is queried for LINQ?

Then LINQ should use the keyword join on equals

Existing code:

        Static voidMain (string[] args) {            varStrarray =New[] {"A","B","C","D","E","F"}; varNumarray =New[] {0,1,2,3,4,5,6,7,8,9 }; varList = fromIinchNumarray Join Sinchstrarray on strarray[i] equals sSelecti; foreach(varIteminchlist) {Console.Write ($"{Item}"); }

See

The array of strings has 6 elements, the number array has 10,

I want to query the elements of the largest array of numbers that match the output of the string array.

is how much of a numeric array is subscript/index that can conform to a string array

There is no where keyword but a join on equals is used

inch Strarray on strarray[i] equals s

Explain this line of code in detail:

Join S in Strarray

Equivalent to

from S in Strarray

-------------------------------------------

On strarray[i] equals s

Equivalent to

where S==strarray[i]

This whole code can be interpreted as using S to draw Strarray when Strarray[i] is equal to S

Then the above code can also be organized as:

           varStrarrat =New[] {"A","B","C","D","E","F"}; varNumarray =New[] {0,1,2,3,4,5,6,7,8,9 }; varList = fromIinchNumarray fromSinchStrarraywherei<Strarray.lengthwherestrarray[i]==sSelectI

As for which way to use, this is a personal hobby.

C # LINQ (5)

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.