Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

multithreading in .net core

static void Main(string[] args) { CancellationTokenSource tokenSource = new CancellationTokenSource(); CancellationToken token = tokenSource.Token; Task.Factory.StartNew(() => SaveFileAsync(path, bytes, token)); } static Task SaveFileAsync(string path, byte[] fileBytes, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { Console.WriteLine("Cancellation is requested..."); cancellationToken.ThrowIfCancellationRequested } //Do some file save operation File.WriteAllBytes(path, fileBytes); return Task.FromResult(0); }Copy
Comment

PREVIOUS NEXT
Code Example
Csharp :: Selecting item from listview in C# 
Csharp :: unity audio source playoneshot 
Csharp :: c# arraylist to listview 
Csharp :: @razor identify last foreach 
Csharp :: .Net 6 Program.cs 
Csharp :: unity ik not working 
Csharp :: wie macht man eine schleife in c# 
Csharp :: embed video to exe file with c# 
Csharp :: how to remove black top bar in asp.net 
Csharp :: .net directorysearcher get manager accountname 
Html :: You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0). 
Html :: how to use unsplash images in html 
Html :: espacio html 
Html :: sweetalert2 cdn 
Html :: align center inner div using bootstrap 
Html :: href email in html 
Html :: input type file accept only images 
Html :: fa icons profile 
Html :: html theme meta 
Html :: remove underline html 
Html :: Wrap the last word of a paragraph in span tags using jQuery 
Html :: remove scroll from a page 
Html :: how do i set a pdf to be download link in html 
Html :: password field odoo 
Html :: how to use google drive image in html 
Html :: html minus sign 
Html :: css border table none 
Html :: in select option how to make one default 
Html :: og html 
Html :: alpine js onclick example 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =