尝试在文件夹内调用类时出现erorr CS0120

时间:2019-05-03 12:41:49

标签: c# xamarin

我正在开发新应用,并且尝试从类中调用FireBase

我有一个新的Xamarin.Form C#2019,文件夹中的类包含一个项目 enter image description here

这是我单击时的按钮

public async void BtnAdd_Clicked(object sender, EventArgs e)
    {
        await DbFirebase.AddPerson(Fname.Text,Phone.Text,Email.Text,Password.Text);
        Fname.Text = string.Empty;
        Phone.Text = string.Empty;
        Email.Text = string.Empty;
        Password.Text = string.Empty;
        await DisplayAlert("Success", "Person Added Successfully", "OK");
        var allPersons = await Data.DbFirebase.GetAllPersons();
        lstPersons.ItemsSource = allPersons;
    }

//这是我在项目数据中称insaide文件夹(数据)的类(DbFirebase.cs)

public async Task AddPerson(string FName, string Phone,string Email, string Password)
    {
        await client
          .Child("Users")
          .PostAsync(new Users()
          { FName = FName,
              Phone = Phone,
              Email =Email,
              Password = Password
          });
    }

enter image description here

我收到错误cs0120(非静态字段xamarin需要对象引用)

0 个答案:

没有答案