简体   繁体   中英

Having WP7 app developed in Android - how to port types from C# to Android?

I have a WP7 application which consumes a Windows Azure web service. I've currently used the portable class library to manage the types shared by the Windows Azure application and the WP7 application. The Azure service is a REST API - WP7 deserializes an instance of one of my classes and sends it to the API, the API serializes it back to the class type and saves it to Azure Table Storage.

To start building this in Android, how do I provide these classes to the Android code? The REST API needs to be able to recognize them and serialize them back to the .NET classes. I know I can convert them to Java, and manage them separately from the C# classes, but is that the best, cleanest way? I don't want to make this a huge project in itself. We're talking about 7 or so classes that probably won't change much.

Thanks!

If you need to be portable to Android I think you need to forget native serialization (but first you need to double check how it is actually serialized).

You will need to go to JSON or XML to be portable.

You can use content type negotiation to provide .net native serialized to WP client and JSON or XML to the Android one.

最好的选择似乎是让Android开发人员将C#类重写为Java类。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM