Are extension methods available on CE framework as well? I have an extension method for string that works fine in a windows forms project, however it wont build in PocketPC application.
I figured this would be an easy thing to find out, however I was unable to find any info regarding extension methods on PocketPC.
Edit: Ooops this was my mistake. I wrote the extension method in Visual Studio 2008, however the PocketPC project was being compiled in Visual Studio 2005, which I didn’t realised. Well that’s a hour of my life I’m never getting back. Thanks everyone for answers anyway.
Wanted to clear up a bit of confusion here. Extension methods are a feature of the compiler, not necessarily a particular version of the framework. Therefore, extension methods can be used on any platform where there is a version of the compiler that supports both extension methods and that platform.
The C# 3.0 compiler can down target to 2.0 frameworks and supports extension methods so they should be available on the compact framework.
The only thing the framework actually provides for extension methods is the ExtensionAttribute. However this doesn’t have any functionality associated with it and can be defined by your application if it’s not available. Here is a blog post I wrote on the subject