c# - LINQ methods executing sequence -


I am reading a book about C # in the advanced level. And, now I am reading this part:

Operation behind Linux query methods - which implement representative-based syntax.

So far, I have where , select , leave , SkipWhile , Read about low , methods while taking the and Defferred and instant execution and Iterator s that comes back by some of these methods.

is a sample of deferred performance execution model by which CLR ensures that the value will be removed only when it is needed from the IEnumerable-based information source. When a link operator uses deferred execution, then the CLR uses the related sequence, such as the original sequence, ingenious, or selector (if any) in an iterator, which will be used when the information is originally toListmethod Or use the ForEachmethod manually or the built-in GetEnumerator and MoveNextmethods in C #.

Now these two examples are taken:

  IList & lt; Int & gt; Chain = new list & lt; Int & gt; () {1, 2, 3, 4, 5, 6, 7}; // The first example series. (X => x> 0) Take (x => x & gt; 0). Ollist (); // second example series. Here (x => x> 0) Take (4) .Olist ();  

When I'm putting breakpoints and debugging these two statements, I can see a difference.

Move () When an item is executed, the condition gets conditional in the where statement

First Statement:

Enter image details here

Second statement:

< Img src = "https://i.stack.imgur.com/sJCIn.png" alt = "Enter image details here">

Can you please explain to me why?

This completely is not clear what you are saying, But if you are asking why you press a breakpoint in Lambda expression in the take time , but you do not hit one of the lo That is not take is not like accepting a representative at all - it only accepts a number

Take with your example, you Programmed two lambda find expressions - a where a and Take . So you can break those lambda expressions in or .

It is important to understand that where and take the methods themselves only once - but they will return to the incoming sequences Each of them evaluates the representative given for each value they encounter.

Maybe you have more information about me at LINQ.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -