Posted on January 7th, 2008 by Paul Stovell
As many people know, LINQ to Objects is made possible via extension methods. A two-second simple example of the where enumerable might look like this:
public static IEnumerable<T> Where<T>(this IEnumerable<T> source, Func<T, bool> predicate)
{
foreach (T sourceElement in source)
{
if (predicate(sourceElement))
[…]
Filed under: C# | 1 Comment »
Posted on December 4th, 2007 by Paul Stovell
There’s a good thread on the ALT.NET mailing list about the use of extension methods over interface methods. Having used extension methods heavily in SyncLINQ, there’s something I wanted to highlight when it comes to choosing between regular methods and extension methods.
Combining extension methods with interfaces can be very powerful. The IEnumerable interface is […]
Filed under: C# | 5 Comments »
Posted on October 4th, 2007 by Paul Stovell
Often when creating classes, we add a number of constructors to the class that are usually just there for convenience’s sake; that is, to make life easier for the developers using the class. Take the following code:
public class Contact
{
private string _firstName;
private string _lastName;
private […]
Filed under: C# | 10 Comments »
Posted on August 4th, 2007 by Paul Stovell
Last week I delivered Readify’s Professional .NET training course to a company in North Ryde, Sydney. The group was made up of a range of experiences in VB6, Java, and InterSystems products. By the end of the week I was feeling pretty worn out, but I was rewarded with some nice review scores from the group: […]
Filed under: C# | 10 Comments »
Posted on July 25th, 2007 by Paul Stovell
Chris Frazier writes: “okay, just to play devil’s advocate…>:) I think the asp.net cache framework fits very nicely for its purpose - what you propose seems like another abstraction on top of it, for the benefit of thinking *less* about what items you should cache to *optimize* code execution time? So, just throw everything possible […]
Filed under: C# | 6 Comments »