gpt4 book ai didi

Java 到 C# 的转换,用于在 xamarin 中制作 androidstudio 应用程序

转载 作者:行者123 更新时间:2023-12-02 11:47:23 25 4
gpt4 key购买 nike

下面的行在 Java (AndroidStudio) 中完美运行,但在 C# (Xamarin) 中返回错误。不知道出了什么问题。我是 C# 新手

private final int NONE = -1, TOUCH_TOP_FIRST = 0, TOUCH_TOP_SECOND = 1, TOUCH_BOT_THIRD = 2, TOUCH_BOT_FOURTH = 3;
int currentTouch = NONE;

在线currentTouch = NONE;

error: A field initialiser cannot reference the non-static field,method or property CameraPreview.NONE

最佳答案

The below line perfectly works in Java (AndroidStudio), but it is returning errors in c# (Xamarin). Don't know what is going wrong. I'm new to C#

final 关键字仅适用于 java,在 C# 中您可以使用 readonly .

如果你是 C# 新手,我建议你快速浏览一下语言教程:C# Guide作为第一步。

那么您可以通过Xamarin for Java Developers了解Android App(Java)和Android App(Xamarin)之间的区别

关于Java 到 C# 的转换,用于在 xamarin 中制作 androidstudio 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48105617/

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