Wednesday, July 29, 2009

LINQPad (new version) - nice tool that can help you to stady LINQ.

LINQPad is nice tool that can help you to study LINQ. I have read firs overview of this tool. Absence auto-complete grieves most people. Auto-complete is present in new version. This option requiring payment. IMHO: auto-complete is more detrimental than efficiency for studying (but very useful for work).
But I want say not about that. LINQPad is obtain other interesting feature. Author of this tool Joseph Albahari with your brother had written book "C# 3.0 in a Nutshell" and he added LINQ samples from this book to LINQPad. You can not only investigate different case moreover you can see how it look in lambda and IL code.

Investigate these samples in IL code should be very interesting ;)

Sunday, July 19, 2009

Do you know about LINQ that.. ?

Do you know about LINQ to SQL that attribute is more important than value? What is it mean? My friend have found interesting relation. He had written LINQ to SQL where he checked a column value to null but he was disappointed - it wasn't worked if it was need. He had null values in set but LINQ code didn't see they (He had written simple test code with foreach - it worked). After some investigate he has found that trouble in mapped data. Particular property was marked ColumnAttribute with set CanBeNull property false. So LINQ implicitly optimizes him code regards attribute's value (skips the check to null).
PS: It shows that we should be careful to small thing.. because small things can implicitly brings a big and strange problems.

Do you know about nested class that.. ?

Download source files - here

Do you know about nested class that you can make nested class as partial? Yep, You can do it. Exactly your main class should be partial too.