I'm using firebase for c# xamarin and I want to do for each user it will check if he has counter, and if not it will generate for him. I tried it like this:
try
{
FirebaseResponse resp = await client.GetAsync(uid+"/counter/node");
result = resp.ResultAs<Counter_Class>();
}
catch
{
var counter = new Counter_Class
{
cnt = "0"
};
SetResponse response = await client.SetAsync(uid + "counter/node", counter);
Counter_Class result = response.ResultAs<Counter_Class>(); //The response will contain the data written
}
When the child exists the try/catch is fine but when it doesn't and the catch need to generate a child it shut down. can I check if the child exists like `if(childexists)? I'm using c# not java