Hi

On 2013.04.17 01:58, Paul Johnson wrote:
Hi,

Why don't You try
var getLoginTask = MyEvents.UserSignIn_Async(username, password);

and see returning type??

UserSignIn_Async returns void. The compiler moaned when I tried

var getLoginTask...
Hm..
Async functions with retrun type void or type return statements must not have expression
(from MS docs)
Now I wonder how is this interpreted/converted? Probably void, cos Your function returns void;
I guess

async Task UserSignIn_Async(string username, string password)
{
return;
}

while You have:

async void UserSignIn_Async(string username, string password)
{
return;
}

and this is reason why

var retval = = MyEvents.UserSignIn_Async(username, password);

moans, You cannot assign void to variable (never crossed-my-mind/tried).


AIUI, if you're firing an event and really don't care what happens (as in this case), then private async void is fine
Have You tried to change sig of the function (actually this is not sig in c# - return value is not
considered like in c++).

I'm not sure about the RunOnUiThread part. My understanding is that as the call is being made in an async method, it has to jump onto the UI thread for something to be displayed.
I think (even Miguel has stated yesterday) that async/await is about freeing us from thinking
about in which context we are and where we return (await completion).

... but I'm still on reading and looking under the hood...

I still try to grasp naming/nomenclature here [lightweight] threads, fibers, co-routines.
It is a great help and will make code robuster and eventually faster..
But what is behind the scenes? Thread created (System.Threading.Thread) or not?.

I guess more reading and channel9 watching

cheers

mel

Thanks

Paul



--
Miljenko Cvjetko dipl.ing. ET
        Direktor/CEO
        Projektant rješenja/Solution Architect  
        Razvojni programer/Senior developer
        Voditelj projekta/Project Manager

IX južna obala 13
Kajzerica Zagreb
T: 385 1 7775555
M: 385 91 557 447 3
F: 385 1 7779556
e: [email protected]
w: http://holisticware.net

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to