Chapter 15

Sharing Code between Mono for Android, MonoTouch, and Windows Phone 7

What's in This Chapter?

  • Understanding the mobile platforms
  • Using class libraries on different platforms
  • One class library to rule them all
  • Building an application that shares code

This chapter guides you through the popular mobile platforms and shows you how you can leverage your .NET and C# skills to develop for each platform. You also will discover how you can share code between these platforms and the possibilities of using one assembly across all three platforms.

To finish the chapter, you will create a sample application that will work across these platforms, learning about interesting differences as you go along.

Overview of the Three Platforms

You can potentially develop for many mobile platforms. The three platforms I am referring to are iOS, Android, and Windows Phone 7. Why these three? You can develop on these platforms using C# and the .NET framework: MonoTouch for iOS, .NET on Windows Phone, and Mono for Android on Android devices. Let's delve into these platforms.

Mono for Android

The Mono for Android default project structure should be relatively familiar to you now, since you likely have been working with Mono for Android through the book. Figure 15.1 shows the default project structure. You can see that you have mscorlib, System, System.Core, System.Xml, and System.Xml.Linq assemblies all included by default. As well as these assemblies, you have a Mono.Android assembly, which contains ...

Get Professional Android Programming with Mono for Android and .NET/C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.