This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Extensions.Hosting; | |
| using Microsoft.Extensions.Logging; | |
| using Microsoft.Extensions.Options; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Net; | |
| using System.Net.Sockets; | |
| using System.Threading; | |
| using System.Threading.Tasks; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This code can be edited and used to retrieve items from a local dataflow BatchBlock<T> | |
| // either when _timeout has hit, or the batch-size given to the BatchBlock constructor was reached | |
| public async Task<T[]> DequeueAsync(CancellationToken token = default) | |
| { | |
| // create a linked token source to cancel the timeout task | |
| // this triggers either when we cancel or the provided token is cancelled | |
| using CancellationTokenSource cts = CancellationTokenSource.CreateLinkedTokenSource(token); | |
| // the first task is a regular tasks waiting for the batch to be triggered |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using System.Threading.Tasks.Dataflow; | |
| namespace Utils; | |
| /// <summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections.Generic; | |
| namespace SimpleMarkdown; | |
| class Testing | |
| { | |
| public static void Test() | |
| { | |
| // either use .With or set MarkdownBuilder.DefaultParseMode to globally set it once | |
| string nice = "Hey!".Bold().Link("https://google.com/").With(ParseMode.Markdown); |