Nach Ordnungsbegriffen durchsuchen

Alle Ordnungsbegriffe » Extension Methods (RSS)

C# Acrobatics : Lambdas and Expression Methods as a replacement for NVelocity von .Net Smoothie

I’ve been very quiet recently. (I’m trying to not be so loud, Scott. ) You see, I’ve been writing a lot of ASP.Net code for a site I’m working on. And, to be honest, I’ve been having a lot of trouble. The source code for...

Design Guidelines for LINQ von .Net Smoothie

Have you wondered if and when you should use the new LINQ features in .Net 3.5? Like, where should I put a new extension method? Should I use Func<T> or a custom delegate? How do I best implement a mix-in (extension methods on an interface)? Well...

ExtensionMethod.net - An Extension Methods Database von .Net Smoothie

While surfing around tonight, I came across ExtensionMethod.net, a database of useful Extension Methods for C# 3.0 and VB 9. I thought it might be useful, so I added a few of my own extension methods. IComparable<T>.LessThan int.Times int.To There...

Can You Pass an Anonymous Type Across Functions? von .Net Smoothie

One of the biggest questions with Anonymous Types is “can I pass them around?” If not, why not? Can you do something like this, for example: var GetAnonymousValue() { return new { Name = “Richard Bushnell” }; } void Main() { var...

Fun with C# Extension Methods: Quick Loops von .Net Smoothie

In my last post, I demonstrated an extension method for easy creation of ranges, using the 1.To(x) syntax, similar to the Ruby [1..x] syntax. Today I’m writing another copy of a Ruby idea which lets you do a quick loop using a terse and easy-to...

Fun with C# Extension Methods: Easy Ranges von .Net Smoothie

I’m not a real Ruby on Rails developer, but I’ve tried to learn it, just to broaden my perspective. Coming from a C# background, I’m impressed by how easy it is to read Ruby code. In fact, it is usually so compact and self-descriptive...

A Mixin for IComparable<T> von .Net Smoothie

Following on from my other posts on C# Mixins, here’s a short one to demonstrate the benefits of Mixins using IComparable<T>. I don’t know about you, but I can never remember how the CompareTo method of IComparable<T> works...

A not-so-simple Mixin with C# 3.0 von .Net Smoothie

My last post gave a simple idea of how to do a Mixin with C#. Rather than repeating what someone else has already done, if you want to see a more complex example of what can be done, check out Create Mixins with Interfaces and Extension Methods by Bill...