【问题标题】:Google Firebase Realtime Database Member namesGoogle Firebase 实时数据库成员名称
【发布时间】:2021-09-20 00:38:15
【问题描述】:

为什么 Firebase 文档在 https://firebase.google.com/docs/database/unity/save-data 上将此列为一个选项?

这是我的代码和错误

public class User2
{

    public string email;
    
    public string myAge;
    public string mySex;
    public string myEth;
    public string myReligion;
    public string myJob;
    public string myKids;
    public string myFKids;
    public string myCovid;
    public string myHeight;
    public string myWeight;
    public string myEye;
    public string theirMinAge;
    public string theirMaxAge;
    public string theirSex;
    public string theirEth;
    public string theirReligion;
    public string theirJob;
    public string theirKids;
    public string theirFKids;
    public string theirCovid;
    public string theirHeight;
    public string theirWeight;
    public string theirEye;

    public User2 ()
    {
    }

    public string User2 (string email1, string myAge1,
    string mySex1,
    string myEth1,
    string myReligion1,
    string myJob1,
    string myKids1,
   string myFKids1,
    string myCovid1,
    string myHeight1,
    string myWeight1,
    string myEye1,
    string theirMinAge1,
    string theirMaxAge1,
    string theirSex1,
    string theirEth1,
    string theirReligion1,
    string theirJob1,
    string theirKids1,
    string theirFKids1,
    string theirCovid1,
    string theirHeight1,
    string theirWeight1,
    string theirEye1)
    {

        this.email = email1;
        this.myAge = myAge1;
        this.mySex = mySex1;
        this.myEth = myEth1;
        this.myReligion = myReligion1;
        this.myJob = myJob1;
        this.myKids = myKids1;
        this.myFKids = myFKids1;
        this.myCovid = myCovid1;
        this.myHeight = myHeight1;
        this.myWeight = myWeight1;
        this.myEye = myEye1;
        this.theirMinAge = theirMinAge1;
        this.theirMaxAge = theirMaxAge1;
        this.theirSex = theirSex1;
        this.theirEth = theirEth1;
        this.theirReligion = theirReligion1;
        this.theirJob = theirJob1;
        this.theirKids = theirKids1;
        this.theirFKids = theirFKids1;
        this.theirCovid = theirCovid1;
        this.theirHeight = theirHeight1;
        this.theirWeight = theirWeight1;
        this.theirEye = theirEye1;
        

    }
    
}

还有我的错误

Assets\Scripts\Buttons.cs(46,19): 错误 CS0542: 'User2': 成员名称不能与其封闭类型相同

当我在类中更改 User2 的名称时,我又遇到了一个错误。

请声明方法的返回类型。

有没有简单的解决方案?

我发现了我的错误。我在其中一种方法中有关键字字符串。解决。

【问题讨论】:

    标签: javascript firebase unity3d firebase-realtime-database


    【解决方案1】:

    我发现了我的错误。我在其中一种方法中有关键字字符串。

    【讨论】:

    • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2017-12-16
    • 1970-01-01
    • 2021-11-05
    • 1970-01-01
    • 1970-01-01
    • 2023-04-08
    • 2018-01-26
    • 2021-12-13
    • 1970-01-01
    相关资源
    最近更新 更多