C# – LINQ – Example for LINQ initialization

Lately I am interested in C# again and thus I have taken a deeper look at LINQ (Language Integrated Query). My previous article, concerning it was here.

I thought it was interesting, that the value in LINQ is calculated after it is used, and not after it’s time to be calculated. cs

Thus, if you take a look at the following simple example, you would see that col1 should not be containing the value of 1000, because it is added later.

However, if you simply run it, you get this:
linqA

And thus, you would see the 1000 inside. That’s how LINQ works! 🙂

Tagged with: ,