0

Error comes up for the method requiring await operators but where do I put them and what is an await operator and async and Task? :)

 public async void OnLocationChanged(Location location)
    {

        _currentLocation = location;
        if (_currentLocation == null)
        {
            _locationText.Text = "Unable to determine your location. Try again in a short while.";
        }
        else
        {
            _locationText.Text =  string.Format("{0:f6},{1:f6}", _currentLocation.Latitude, _currentLocation.Longitude);
            as

        }
    }

I want specific help in the example above :)

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
  • http://stackoverflow.com/a/19985988/2850543 https://msdn.microsoft.com/en-us/library/mt674882.aspx – Millie Smith May 19 '16 at 16:49
  • Possible duplicate of [how to and when use \`async\` and \`await\`](http://stackoverflow.com/questions/14455293/how-to-and-when-use-async-and-await) – Millie Smith May 19 '16 at 16:51
  • To address your edit of "I want specific help in the example above": If you read the docs on async, await, and Task, you will understand how to fix your problem. You won't get far if you don't understand your tools. – Millie Smith May 19 '16 at 16:56
  • @TingAli: You'll find that `async` adoption works best if you approach it the opposite way. That is, first make your "leaves" call async APIs and `await` them, then make the containing methods `async` and `await` them, etc. – Stephen Cleary May 19 '16 at 20:29

1 Answers1

1

Just remove asycn keyword from method's signature !

public void OnLocationChanged(Location location)
Kevorkian
  • 430
  • 2
  • 4
  • 14