Coba kalau processnya dibikin lama?
Ngefek ga? process yang di async? :)
Best Regards,
Nicko Satria Utama, MCTS
blogs : http://nickotech2000.blogspot.com
From: Yakin Zure <[email protected]>
To: "[email protected]" <[email protected]>
Sent: Wednesday, 20 July 2011, 9:02
Subject: [Mugi] Nanya tentang Asynchronous di C#
Mau nanya nih, apa sih keuntungan menggunakan Asynchronous Method ketimbang
yang gak make? dan Bagaimana caranya misalnya kita memproses sesuatu yang lama
prosesnya, misalnya menghitung huruf konsonan pada sebuah kalimat yang panjang,
trus bisa tidak disaat proses menghitung tersebut kita jalankan proses yg lain
tanpa terbebani oleh proses perhitungan huruf konsonan tsb?
saya dah nyoba pake Async tapi kok gak ngefek ya?
Misalnya codingnya seperti ini :
======================================================
delegate int AsyncProsesHitung();
public int AsyncHitungVokal()
{
AsyncProsesHitung AsyncVokal = new AsyncProsesHitung(HitungVokal);
IAsyncResult iar = AsyncVokal.BeginInvoke(null, null);
while (!iar.IsCompleted)
{
//Lakukan hal lain tanpa terpengaruh Proses diatas
}
int Hasil = AsyncVokal.EndInvoke(iar);
return Hasil;
}
public int HitungVokal()
{
int jmlVokal = 0;
for (int i = 1; i <= this.Content.Characters.Count; i++)
{
if (this.Content.Characters[i].Text.ToLower() == "a" ||
this.Content.Characters[i].Text.ToLower() == "i" ||
this.Content.Characters[i].Text.ToLower() == "u" ||
this.Content.Characters[i].Text.ToLower() == "e" ||
this.Content.Characters[i].Text.ToLower() == "o")
{
jmlVokal++;
}
}
return jmlVokal;
}
=============================================
_______________________________________________
To unsubscribe from this group, send an email to:
[email protected]
Get Free 5 GB mailbox Check this http://www.mugi.or.id
Powered by bisnismedia.com_______________________________________________
To unsubscribe from this group, send an email to:
[email protected]
Get Free 5 GB mailbox Check this http://www.mugi.or.id
Powered by bisnismedia.com