Improvement to extension method syntax

I'm blogging this before my sleep-deprived mind (3 hours in the last 33, and I'm getting up for the day in an hour or so) loses it.

One of the things I don't like about the proposed extension methods is the way the compiler is made aware of them - on a namespace basis. "Using" directives are very common to add for any namespace used in a class, and quite often I wouldn't want the extension methods within that namespace to be applied. I propose using using static System.Query.Sequence; instead, in a way that is analogous to the static imports of Java 1.5 (except without importing single members or requiring the ".*" part. This would make it clearer what you were actually trying to do.

Published Wed, Sep 28 2005 15:19 by skeet
Filed under:

Comments

# Extension methods late binding = trouble?

Tuesday, November 22, 2005 2:05 PM by TrackBack

# re: Improvement to extension method syntax

Hi Jon,

You might be interested in the material I just posted on my blog. It's a way to provide better control over when extension methods are used. It's mostly about the versioning problems with extension methods, but it might (partially) address your concerns too.

Friday, April 07, 2006 1:24 AM by Jon

# C# 6: First reactions

It's been a scandalously long time since I've blogged about C#, and now that the first C# 6 preview

Friday, April 04, 2014 4:38 PM by Jon Skeet: Coding Blog

# C# 6: First reactions - Bilim-Teknoloji | Pozitive Positive Pozitive.NeT

Pingback from  C# 6: First reactions - Bilim-Teknoloji | Pozitive Positive Pozitive.NeT