C#

CancellationToken

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

CancellationToken i lejon një pune async të ndalet në mes — p.sh. kur përdoruesi klikon „Anulo“ ose kalon kohëzgjatja. Ia jep tokenin metodës, dhe ajo e kontrollon herë pas here.

EnglishEN

A CancellationToken lets an async job stop halfway — e.g. when the user clicks “Cancel” or a timeout passes. You pass the token to the method, and it checks it from time to time.

Si ta mendosh

Si fishkëllima e gjyqtarit që e ndal lojën në çdo moment.

Lexoje në anglisht

Like the referee's whistle that can stop play at any moment.

Shembull kodicsharp

using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
await http.GetStringAsync(url, cts.Token);

Terma të lidhur