Browse by Tags
All Tags »
Source (
RSS)
I'm not that much a fan of fluent interfaces , but in some cases they are well fit. A great example is the fluent repeater created by Adrian Aisemberg. It's also a good example if you don't know what a fluent interface is. Here is sample code that uses...
C# 3.0 and VB.NET 9.0 introduced implicit typing. When you use anonymous types, it's required. The rest of the time, it's mostly a judgment call to decide whether to use implicitly-typed local variables or not. An interesting discussion is going on about...
A frequent question we get about our LINQ book is whether it's been written for C# developers only. If you think so, you're making a mistake. We cover both C# and VB.NET in the book. This is one big difference with competing books. Even if not all code...
Yesterday, a developer asked in the LINQ in Action forum and in Microsoft's official LINQ forum how to write a LINQ to SQL query that would return random records from the database. It's not something built-in. There is no Random query operator provided...
Did you know that depending on the way you rethrow exceptions you may lose important information? There are already several blog posts that explain and demonstrate the difference between throw and throw ex . I'm realizing only now that none of the two...
Way too often developers take the easy solution to use try..catch blocks to silence and ignore exceptions. There are two things to do when you see this happening: Explain the developers why it's a bad practice (exceptions are costly and their use should...
If for some reason you need to convert an ISBN-13 to ISBN-10 (one being that Amazon doesn't support ISBN-13 in product affiliate links) then you need not only to remove the first three characters. You also need to recompute the checksum. Here is a piece...
Often, when you try to find out how to write the correct LINQ query you need, you end up being confused because it becomes too complex. In such situations, you should remember that the let clause is here to help you. Let's see is an example from the official...
I've been quiet lately about PageMethods because other projects kept me busy and contrarily to what I wished, I haven't been able to create PageMethods Pro last year. Considering the facts that other important projects will continue to keep me...
Paul Sheriff has just published an example he uses to recommend the use of try..finally blocks. Here is his example: private void CreateLogFile() { try { StreamWriter sw = new StreamWriter(@"D:\Samples\Test.txt", true, System.Text.UTF8Encoding...
More Posts
Next page »