Extension methods and .NET 2.0

I've enabled C# 3.0 extension methods in a .NET 2.0 project using the technique described at the end of this article: http://msdn.microsoft.com/msdnmag/issues/07/11/BasicInstincts/#S7

Specifically, I've provided my own implementation of System.Runtime.CompilerServices.ExtensionAttribute in my own assembly. This is sufficient for Visual Studio to successfully compile any extension methods declared in my .NET 2.0 project.

R# 4.0 however is showing errors in my extension method declarations, saying that, to declare extension methods, my project must reference System.Core.dll (which is not available for .NET 2.0 projects).

Can the behavior of R# 4.0 in this case be aligned with that of the C# 3.0 compiler? I'm not sure if the technique described above is officially supported by Microsoft, but it seems to have been fairly widely adopted as the preferred way to enable extension methods in .NET 2.0 projects.

2 comments
Comment actions Permalink

Hey Tehau!
Sorry, have no idea how to answer your question, or even what your question is for that matter, but the efforts I go to to track you down! drop me an email boy, would love to catch up.
Karen xx

0
Comment actions Permalink

And who said R# couldn't refactor your social life? :-D

"kaz" <jagged_little@hotmail.com> wrote in message
news:31705847.2721205658602934.JavaMail.jive@app4.labs.intellij.net...

Hey Tehau!
Sorry, have no idea how to answer your question, or even what your
question is for that matter, but the efforts I go to to track you down!
drop me an email boy, would love to catch up.
Karen xx


0

Please sign in to leave a comment.