gpt4 book ai didi

c# - Xamarin 在 iOS、Android 和 Core 项目之间共享代码

转载 作者:太空狗 更新时间:2023-10-29 13:25:26 24 4
gpt4 key购买 nike

我是 Xamarin 的新手,为 Android 和 iOS 制作了两个界面。我有一个 Core 项目,并在 Android 和 iOS 项目中引用了 Core 项目。

如何在我的 iOS/Android 项目中使用我的核心项目中的代码?

例如,这是我的核心类 TestClass.cs:

using System;
using System.Threading.Tasks;

namespace FindMyRide.Core
{
public class TestClass
{

public string TestString { get; set; }

public TestClass ()
{
TestString = "Hallo";
}
}
}

如何在我的 iOS 或 Android 应用程序中显示 TestString?

我不知道这是否是 Xamarin 中共享编码的正确用法,因为我说过我对此和 C# 非常陌生。

最佳答案

你可以build a PCL或使用 code sharing 构建特定于平台的库.

关于c# - Xamarin 在 iOS、Android 和 Core 项目之间共享代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21728830/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com