Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Error using Xamarin Essentials' Geocoding

$
0
0

Hi,

I am trying to use the new Xamarin Essentials Geocoding from this doc:

https://docs.microsoft.com/en-us/xamarin/essentials/geocoding?context=xamarin%2Fxamarin-forms&tabs=android

The code looks like this:

var location = await Geolocation.GetLocationAsync();

latitude = location.Latitude;
longitude = location.Longitude;

var placemarks = await Geocoding.GetPlacemarksAsync(latitude, longitude);
var placemark = placemarks?.FirstOrDefault();

await DisplayAlert("latitude", Convert.ToString(latitude), "Ok");
await DisplayAlert("longitude", Convert.ToString(longitude), "Ok");
await DisplayAlert("country", placemark.CountryCode, "Ok");

but I am getting this error:

**Error CS1061: 'IEnumerable' does not contain a definition for 'FirstOrDefault' and no extension method 'FirstOrDefault' accepting a first argument of type 'IEnumerable' could be found (are you missing a using directive or an assembly reference?) (CS1061)
**

Thanks,
Jassim


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>