I have a json response like below:
{
"usersList": [
{
"fullname": "Sreejith",
"email": null,
"phone": null
},
{
"fullname": "",
"email": "[email protected]",
"phone": null
},
{
"fullname": "",
"email": null,
"phone": "8956231245"
},
]
}
Currenntly I am binding the fullname value like below:
<Label
Text="{Binding fullname}"
Font="Bold,17"
TextColor="#676767"
HorizontalOptions="Start"
VerticalOptions="Center"/>
But in some cases the fullname value is empty, so in that case I want to set the email value to label, also if email is null need to set the phone value. First preference is for fullname, then for email last for phone.
I created a new property like below, but getting an error for get: Error is not all code paths return a value.
public string NameToVisualize { get { if (fullname != null) return fullname;
else if (email != null) return email;
else if (phone1 != null) return phone1; } }
Is this method work?