In 2006 I did a presentation on that focused on .NET Compact Framework for Desktop Developers where the core focus was on how to leverage existing code from the full desktop .NET Framework and .NET Compact Framework.
Well seven years later (yes I’ve been doing this a long time!), some of those techniques are still usable with all the different mobile platforms available and as a developer you definitely want to leverage as much code as possible.
In the next series of articles, I will go through some techniques on sharing code across different platforms including Windows Phone 7, Windows Phone 8 and Windows 8. You can use some of the techniques also on iOS and Android using Xamarin.
The following topics will be covered:
- Sharing Code Part I: Common Source File (source code download)
- Sharing Code Part II: Partial Classes (source code download)
- Sharing Code Part III: Conditional Compile (source code download)
- Sharing Code Part IV: Portable Class Libraries (source code download)
I have personally used these techniques with various products we have built plus customer work. By the end of the series, hopefully you will have a good understanding on how to leverage your code across different platforms using C#.
Note that the samples being used are not using anything like MVVM or other frameworks as it’s something I was using my 11yr old son on using programming to solve some math homework he had and I wanted to keep it as simple as possible.