Posts

Showing posts from September, 2023

Shawn Wildermuth

Coding Shorts: Don't Be Afraid of Pattern Matching in C# https://www.youtube.com/watch?v=o86RTNme3eU 09:09 - pattern matching can be used with ranges var msg = value switch {  ...   (>=35 $$ < 255) => "large"  ... } 11:03 - pattern matching range and tuple can be combined var msg = (status, value) switch {  ...   ("failed", >=35 $$ < 255) => "error"  ... } 13:07 - example of pattern matching with named tuples and using it with a class instance 14:06 - pattern matching with array

Nick Chapsas

The CORRECT way to implement Retries in .NET https://www.youtube.com/watch?v=nJH0PC2Pubs 05:23 - use Polly for retry logic 05:40 - demo of defining a policy 06:43 - you can define the policy to only fire on specific httpstatus code, for example a 500 07:38 - use RetryAsync for a basic retry attempt (not recommended) 10:08 - exponentially backoff can be problematic if the wait times are high 12:00 - use WaitAndRetryAsync to implement a basic exponentially retry 12:10 - use Polly.Contrib.WaitAndRetry to add a jitter strategy 14:18 - alternatively, you can use Microsoft.Extensions.Http.Polly allows you to globally add Polly on the httpclient instance