简体   繁体   English

在Android中开发了WP7应用-如何将类型从C#移植到Android?

[英]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. 我有一个使用Windows Azure Web服务的WP7应用程序。 I've currently used the portable class library to manage the types shared by the Windows Azure application and the WP7 application. 我目前使用可移植类库来管理Windows Azure应用程序和WP7应用程序共享的类型。 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. Azure服务是一种REST API-WP7反序列化我的一个类的实例并将其发送到API,API将其序列化回类类型并将其保存到Azure Table Storage。

To start building this in Android, how do I provide these classes to the Android code? 要开始在Android中构建它,如何为Android代码提供这些类? The REST API needs to be able to recognize them and serialize them back to the .NET classes. REST API需要能够识别它们并将它们序列化回.NET类。 I know I can convert them to Java, and manage them separately from the C# classes, but is that the best, cleanest way? 我知道我可以将它们转换为Java,并与C#类分开进行管理,但这是最好,最简洁的方法吗? 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. 我们谈论的是大约7个可能不会改变太多的类。

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). 如果您需要移植到Android,我想您需要忘记本机序列化(但是首先您需要仔细检查其实际序列化方式)。

You will need to go to JSON or XML to be portable. 您将需要使用JSON或XML进行移植。

You can use content type negotiation to provide .net native serialized to WP client and JSON or XML to the Android one. 您可以使用内容类型协商来提供.net本机序列化为WP客户端和JSON或XML序列为Android。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从WP7 / C#中的应用程序获取信息到BackgroundAgend? - How to get information to the BackgroundAgend from the App in WP7/C#? 无法使用C#开发的Android应用接收json - Not able to receive json from Android app developed using C# Android到WP7绝对新手问题:C#或VB? - Android to WP7 absolute newbie question: C# or VB? WP7 C#一个应用程序与另一个应用程序有多近? - WP7 C# How close one application from another? WP7如何在C#中添加样式 - WP7 How to add the style in C# 将此端口从WP7移植到Windows 8 - Port this from WP7 to Windows 8 从WP7到Universal App的自定义动画端口因SetTargetProperty而失败 - Custom Animation Port to Universal App from WP7 fails with SetTargetProperty 如何从Visual Studio中开发的Android C#应用程序访问SoftLayer对象存储。 - How do I access SoftLayer object storage from a C# application for Android, developed in Visual Studio. 任何有跨平台 WP7 Android iOS 移动开发架构经验的人(monotouch、monodroid、C#) - Anyone have experience with architecture for cross platform WP7 Android iOS mobile development (monotouch, monodroid, C#) 绘图应用程序的等效橡皮擦,c#,silverlight,wp7 - Eraser equivalent for a drawing app, c#, silverlight, wp7
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM