8000 GitHub - conradakunga/BlogCode: Code from my blog - https://conradakunga.com/blog
[go: up one dir, main page]

Skip to content

conradakunga/BlogCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

948 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blog

Code for the examples on my blog - https://conradakunga.com/blog

December 2025

31 December 2025 - Scheduling Libraries In C# & .NET - Part 2 - Hangfire - Hangfire

30 December 2025 - Scheduling Libraries In C# & .NET - Part 1 - Quartz.NET - Quartz.NET

24 December 2025 - Overriding EndPoint Authorization When Using A Single ASP.NET Carter Module In C# & .NET - Overriding authorization when using a single Carter modules.

23 December 2025 - Overriding EndPoint Authorization When Using Multiple ASP.NET Carter Modules In C# & .NET - Overriding authorization when using multiple Carter modules.

22 December 2025 - Alternatively Setting Up Web API Endpoints To Collectively Require Authentication With Carter In C# & .NET - How to require all endpoints be authorized when using a single Carter module.

21 December 2025 - Setting Up Web API Endpoints To Collectively Require Authentication With Carter In C# & .NET - How to require all endpoints to use authorization when using multiple Carter modules.

19 December 2025 - Setting Up Web API Endpoints To Collectively Require Authentication In C# & .NET - Using MapGroup to secure multiple endpoints.

18 December 2025 - Security Benefits of Path.Combine & DirectoryInfo in C# & .NET - Securing paths with Path.Combine and C7D2 DirectoryInfo.

17 December 2025 - Conditionally Serializing XML By Request Accept Header In C# & .NET - Conditional XML / JSON generation from Accept header.

16 December 2025 - Extending The Results Type For XML Serialization In C# & .NET - Extend the Results type to support XML.

15 December 2025 - Building A Helper For XML Generation In C# & .NET - Helper for XML generation

14 December 2025 - Dynamically Changing Decimal & Thousand Separators At Runtime - Configuring thousand and decimal separators

13 December 2025 - Manually Generating XML Output in ASP.NET - Manually generating XML output

12 December 2025 - Making JSON Deserialization Case Insensitive in C# & .NET - Case-insensitive JSON

8 December 2025 - How To Securely Handle Duplicate JSON Properties In C# .NET - How to deal with duplicate JSON attributes

3 December 2025 - FIX - The number of row value expressions in the INSERT statement exceeds the maximum allowed number of 1000 row values - How to overcome the SQL Server 1,000 row bulk insert limit

November 2025

28 November 2025 - Writing A Generic Operating System method-level attribute for xUnit in C# & .NET - How to create a generic attribute that allows you to specify the operating system(s) to run under

27 November 2025 - Writing A Linux-only method-level attribute for xUnit in C# & .NET - How to create Linux only test methods

26 November 2025 - Writing A macOS-only method-level attribute for xUnit in C# & .NET - How to create macOS only test methods

25 November 2025 - Writing A Windows-only method-level attribute for xUnit in C# & .NET - How to create Windows only test methods

24 November 2025 - Writing Operating Specific Test Assertion For xUnit In C# & .NET - Operating system specific xUnit assertions

23 November 2025 - Beware - ParseExact Over Parse When Processing Dates In C# & .NET - Gotchas from localization when parsing dates

22 November 2025 - How To Flatten Aggregate Exceptions In C# & .NET - Flatten aggregate exceptions

21 November 2025 - How To Deal With Nested Exceptions In C# & .NET - Dealing with nested exceptions

20 November 2025 - How To Deal With Aggregate Exceptions In C# & .NET - Dealing with aggregate exceptions

17 November 2025 - How To Get An Available TCP Port From The Operating System In C# & .NET - Getting a TCP port from the OS

16 November 2025 - How To Execute Database Queries In Parallel In C# & .NET - Safely execute queries in parallel

15 November 2025 - Beware - Parallel.ForEach And Async Don't Play Well Together - Gotcha when using async code with Parallel constructs

14 November 2025 - How To Serialize Numbers As Strings Using System.Text.Json In C# & .NET - Serialize numbers as strings in json

13 November 2025 - How To Deserialize Numbers Serialized As Strings Using System.Text.Json In C# & .NET - Deserialize numbers serialized as strings in json

10 November 2025 - Splitting A String Into An Array In C# & .NET - Splitting a string into an array

9 November 2025 - Checking If Collection Enumeration Is Cheap In C# & .NET - Cheap checks for collection emptiness

7 November 2025 - Beware - Missing Serilog Entries On Application Exit - Ensuring logs are flushed

6 November 2025 - How To Log Complex Objects With Serilog - Log complex objects with Serilog

4 November 2025 - How To Check If You Can Write To A File In C# & .NET - Checking if you can write to a file

3 November 2025 - Using The Field Keyword In C# & .NET - Using the field keyword

2 November 2025 - Creating Static Extension Properties In C# & .NET - Static extension properties

1 November 2025 - Creating Static Extension Methods In C# & .NET - Static extension methods

October 2025

31 October 2025 - Writing & Testing Code That Expects The Current Date & Time Using The TimeProvider in C# & .NET - Writing & testing code that uses the current date

30 October 2025 - Working With appsettings.json In A Team In C# & .NET - A solution to shared appsettings.json problems

28 October 2025 - Using Extension Members To Add Properties To Types In C# & .NET - Extension properties

27 October 2025 - Adding Date Computations Support To DateTime In C# & .NET - Extension methods for DateTime

26 October 2025 - Getting The Start and End Of The Next Year In C# & .NET - Get start and end of the next year

25 October 2025 - Getting The Start and End Of The Previous Year In C# & .NET - Get start and end of the previous year

24 October 2025 - Getting The Start and End Of The Current Year In C# & .NET - Get start and end of the current year

23 October 2025 - Getting The Start and End Of The Next Quarter In C# & .NET - Get start and end of the next quarter

22 October 2025 - Getting The Start and End Of The Previous Quarter In C# & .NET - Get start and end of the previous quarter

21 October 2025 - Getting The Start and End Of A Quarter In C# & .NET - Get start and end of the current quarter

19 October 2025 - Custom Sorting To Ignore Articles Like 'A' & 'The' In C# & .NET - Custom sorting to ignore articles

14 October 2025 - Serializing Enums With System.Text.Json In C# & .NET - Serializing enums

8 October 2025 - Writing To The Windows Event Log In C# & .NET - Writing to the Windows Event Log

6 October 2025 - Getting The Name Of A File Without Its Extension In C# & .NET - Getting the name of a file without its extension

5 October 2025 - How To Unit Test A Class With Options In C# & .NET - Unit testing a class with constructor injected options

3 October 2025 - Getting A Constant Value From A .NET Executable in PowerShell - Extract a constant from an EXE in PowerShell

1 October 2025 - Getting The Time In Different Timezones In C# & .NET - How to get the time in different time zones

September 2025

30 September 2025 - Converting Between Calendars AKA October MOSTLY Has 31 Days - Differences in dates between calendars.

29 September 2025 - Correctly Getting The Number Of Days In A Month In C# & .NET - How to correctly get the number of days in a month

27 September 2025 - Generating Random Booleans In C# & .NET - Generate random booleans

26 September 2025 - Generating Random Unsigned 64 Bit Integers In C# & .NET - Generate random unsigned 64 bit integers

25 September 2025 - Generating Random Unsigned Integers In C# & .NET - Generate random unsigned integers

24 September 2025 - Generating Random Values For Other Integral Types In C# & .NET - Generate random values for other integral types

21 September 2025 - Random Sampling Of Arrays In C# & .NET - Random array sampling

20 September 2025 - Shuffling Arrays In C# & .NET - Shuffling arrays

19 September 2025 - Restricting Numbers To A Range In C# & .NET - Restringing numbers to a bounded range

17 September 2025 - Documentation Needs Love - Broken Samples - MS Graph sample code that compiles

14 September 2025 - Getting The Downloads Location On macOS In C# & .NET - Getting the downloads location in macOS

13 September 2025 - Getting The Downloads Location On Windows In C# & .NET - Getting the downloads location in Windows

9 September 2025 - Changing The Decimal Separator In C# & .NET - Changing the decimal separator in C# & .NET

8 September 2025 - Sep Is The Short Date Format For September. Sometimes - The short form of September is not what you think

7 September 2025 - Getting the Version of Kibana Connected in C# & .NET - Get version of Kibana connected

6 September 2025 - Getting the Version of ElasticSearch Connected in C# & .NET - Get version of ElasticSearch connected

4 September 2025 - Getting the Version of Redis Connected in C# & .NET - Get version of Redis connected to

3 September 2025 - Other RabbitMQ IConnection Server Properties - Other properties available in the ServerProperties object

2 September 2025 - Getting The Version Of RabbitMQ Connected - How to determine the version of RabbitMQ connected to

August 2025

27 August 2025 - Sending Email In C# & .NET - Part 12 - Sending Email With Attachments Using MailKit - How to send email with attachments using MailKit.

26 August 2025 - Sending Email In C# & .NET - Part 11 - Sending HTML Email Using MailKit - How to send HTML email using MailKit

25 August 2025 - Sending Email In C# & .NET - Part 10 - Sending Plain Text Email Using MailKit - How to send email with MailKit

23 August 2025 - Working With Dates In Multiple Locale Formats Simultaneously - Working With Dates In Multiple Locale Formats

22 August 2025 - How To Sort Strings That Contain Numbers In C# & .NET - How To Sort Strings That Contain Numbers

20 August 2025 - The Difference Between String.Format and ToString - The Difference Between String.Format and ToString

19 August 2025 - Adding Ordinal Support To DateTime Format Strings In C# & .NET - Adding Ordinal Support To DateTime Format Strings

18 August 2025 - Displaying Ordinal Words In C# & .NET - Displaying Ordinal Words

17 August 2025 - Displaying Ordinal Numbers In C# & .NET - Displaying Ordinal Numbers

13 August 2025 - Class That Stores Multiple Named Typed Generic Lists - Improvement - Improvement to the class

12 August 2025 - Class That Stores Multiple Named Typed Generic Lists - Class That Stores Multiple Named Typed Generic Lists

11 August 2025 - Repeat - xUnit Attribute to Run Tests Multiple Times - Repeat - xUnit Attribute to Run Tests Multiple Times

10 August 2025 - Building A Simple Password Generator In C# & .NET - Part 7 - Generating Multiple Passwords - Generating Multiple Passwords

9 August 2025 - Building A Simple Password Generator In C# & .NET - Part 6 - Updating Console UI For Memorable Password Generation - Updating Console UI For Memorable Password Generation

8 August 2025 - Building A Simple Password Generator In C# & .NET - Part 5 - Generating Memorable Passwords - Generating Memorable Passwords

7 August 2025 - Building A Simple Password Generator In C# & .NET - Part 4 - Generating Human Readable Passwords - Generating Human Readable Passwords

6 August 2025 - Building A Simple Password Generator In C# & .NET - Part 3 - Advanced UI With Spectre.Console - Advanced UI With Spectre.Console

5 August 2025 - Building A Simple Password Generator In C# & .NET - Part 2 - Novice UI With Spectre.Console - Novice UI With Spectre.Console

4 August 2025 - Building A Simple Password Generator In C# & .NET - Part 1 - Intro

3 August 2025 - Generating A Cryptographically Random String In C# & .NET - Generating a cryptographically random string

2 August 2025 - Generating A Random String In C# & .NET - Generating a random string

1 August 2025 - Adding Items To An Existing List In C# & .NET - Adding items to an existing list

July 2025

30 July 2025 - Mutative vs Non-Mutative List Manipulation In C# & .NET - Manipulating lists that mutate

28 July 2025 - Sending Email In C# & .NET - Part 9 - Sending Multiple Format Email Using SMTP - Sending multi-format email

27 July 2025 - Sending Email In C# & .NET - Part 8 - Sending HTML Email Using SMTP - Sending inline images using SMTP

26 July 2025 - Sending Email In C# & .NET - Part 7 - Sending Inline Images Using SMTP - Sending inline images using SMTP

24 July 2025 - Displaying User-Friendly TimeSpans In C# & .NET - Displaying TimeSpan objects

20 July 2025 - Sending Email In C# & .NET - Part 4 - Using Office 365 & MS Graph API - Sending email - part 4

19 July 2025 - Sending Email In C# & .NET - Part 3 - Using Gmail - Sending email - part 3

18 July 2025 - Sending Email In C# & .NET - Part 2 - Delivery - Sending email - part 2 - delivery

17 July 2025 - Sending Email In C# & .NET - Part 1 - Introduction - Sending email - part 1

16 July 2025 - Pet Peeve - Properly Pluralizing Counts In C# & .NET - Pluralizing counts

14 July 2025 - How to Wait in C# & .NET - How to wait in applications

10 July 2025 - Determining The Architecture Of An Emulated 32 Bit Running Process In .NET On Windows - Determining architecture of a running process

6 July 2025 - Get IP Address Of Web Server From ASP.NET WebAPI EndPoint - Injecting the IServer into endpoints

3 July 2025 - Writing Debugger-Friendly Objects in C# & .NET - Writing debugger-friendly objects

June 2025

27 June 2025 - Connecting to Secured RabbitMQ Over SSL in C# With EasyNetQ - Connect to RabbitMQ over SSL.

16 June 2025 - Locale Considerations When Parsing Dates - Locale considerations when parsing dates.

15 June 2025 - Don't Parse - TryParse - Parsing data safely.

14 June 2025 - F# Discriminated Unions & Their Benefits - F# Discriminated Unions

8 June 2025 - C# Dictionary Usage Optimizations - TryGet - C# Dictionary Usage Optimizations - TryGet

7 June 2025 - C# Dictionary Usage Optimizations - TryAdd - C# Dictionary Usage Optimizations - TryAdd

5 June 2025 - How to Deserialize JSON Using HttpClient Using C# In .NET - JSON Deserialization options

3 June 2025 - Exposing Collections As Read-Only In C# & .NET - How to expose collections safely.

2 June 2025 - Using the Generic Math Interface in C# & .NET - Simplifying numeric logic with the generic math interface

May 2025

28 May 2025 - Calling Async Methods In Constructors In C# - How do deal with async logic when setting object state

24 May 2025 - Using Tuples In Deconstructors - Using tuples in deconstructors

23 May 2025 - Not All .NET Exceptions Can Be Caught - The Case Of StackOverflow - Stack Overflows cannot be caught

21 May 2025 - Determining the Operating System SQL Server Is Running On Remotely - How to determine the operating system SQL Server is running on.

16 May 2025 - Order of Settings Precedence for .NET Applications - Precedence of settings

14 May 2025 - Overriding appsettings.json Via Environment Variables - Overriding settings via environment vars

13 May 2025 - Overriding appsettings.json Via Command Line - Overriding settings via command line

11 May 2025 - Setting The Staging & Production Environments During Development - Setting environments

10 May 2025 - Flexible Leveraging Of appsettings.json In .NET Applications - AppSettings.json leveraging

8 May 2025 - Computing SHA256 & Other Checksums In C# & .NET - Checksum Computations

7 May 2025 - Dapper Part 16 - Consideration When Passing Parameters - Consideration When Passing Dapper Parameters

6 May 2025 - Tip - Command Text & Stored Procedure Specification In Dapper - Simplified Dapper execution

April 2025

16 April 2025 - Resolve IPAddress From Domain In C# - Resolving IP Addresses

14 April 2025 - Beware - Environment.NewLine Is Not A Silver Bullet - NewLine gotchas.

13 April 2025 - Using Serilog & Structured Logging In Testing - Part 3 - Testing Log Messages - Testing log messages

12 April 2025 - Using Serilog & Structured Logging In Testing - Part 2 - Configuring Logging Destinations - Logging to Elastic Search & Seq

11 April 2025 - Using Serilog & Structured Logging In Testing - Part 1 - Logging Test Output - Logging test output

9 April 2025 - Using State Machines In .NET - Part 12 - State Activation & Entry - Using state machines - state activation & entry.

7 April 2025 - Using State Machines In .NET - Part 11 - Logic Based On How A State Was Transitioned - Using state machines - conditional transitioning events.

6 April 2025 - Using State Machines In .NET - Part 10 - Generating State Diagrams - Using state machines - generating state diagrams.

5 April 2025 - Using State Machines In .NET - Part 9 - Calling Asynchronous Methods - Using state machines - async methods.

2 April 2025 - Using State Machines In .NET - Part 8 - Firing Events Before State Change - Firing events before state change.

March 2025

31 March 2025 - Using State Machines In .NET - Part 7 - Conditional State Transitions - Conditional state transitions

30 March 2025 - Using State Machines In .NET - Part 6 - Firing Events On State Change - Events on state change

28 March 2025 - Using State Machines In .NET - Part 5 - Using Complex & Nested States - Using state machines - nested states.

27 March 2025 - Using State Machines - Part 4 - Using Multiple Triggers - Using state machines - multiple triggers.

26 March 2025 - Using State Machines - Part 3 - Setting Initial State - Using state machines - setting initial state.

25 March 2025 - Using State Machines - Part 2 - Basic Usage - Using state machines implementation.

24 March 2025 - Using State Machines - Part 1 : Introduction - Using state machines introduction.

22 March 2025 - Threading Issue When Populating MemoryCache - Threading issue when using MemoryCache

21 March 2025 - Improving ASP.NET Content Negotiation XML Serialization Performance Using A RecyclableMemoryStream - Using the RecyclableMemoryStream

20 March 2025 - SLNX - New .NET Solution File Format - The new .SLNX format

19 March 2025 - Organizing .NET Projects With Solutions - Organizing projects with solutions

18 March 2025 - Conditionally Output CSV Using ASP.NET Minimal API - ASP.NET Content Negotiation for CSV

17 March 2025 - Conditionally Output XML Or JSON Using ASP.NET Minimal API - ASP.NET Content Negotiation for XML

16 March 2025 - Changing The Port Of An ASP.NET Web Application Or API - Changing The Port Of An ASP.NET Web Application Or API

15 March 2025 - Controlling Publishing Of Satellite Resource Assemblies - Controlling Publishing Of Satellite Resource Assemblies

13 March 2025 - Beware - Order Of DataTable Column Definitions Matters For User Defined Table Type Mapping - Gotcha when mapping to user-defined table types.

12 March 2025 - Dapper Part 15 - Using the IN Clause - Dapper Part 15 - Using the IN Clause

11 March 2025 - Dapper Part 14 - Multithreading - Dapper Part 14 - Multithreading

10 March 2025 - Dapper Part 13 - Using Transactions - Dapper Part 13 - Using Transactions

8 March 2025 - Dapper Part 12 - Alternative Bulk Insert Technique - Dapper Part 12 - alternative bulk insert

7 March 2025 - Dapper Part 11 - Using Inheritance - Dapper Part 11 - Inheritance

6 March 2025 - Dapper Part 10 - Handling Cancellations - Dapper Part 10 - Cancellation

5 March 2025 - Dapper Part 9 - Using Dynamic Types - Dapper Part 9 - Dynamic types

4 March 2025 - Dapper Part 8 - Controlling Database Timeouts - Dapper Part 8 - Timeouts

3 March 2025 - Dapper Part 7 - Adding DateOnly & TimeOnly Support - Dapper Part 7 - adding DateOnly and TimeOnly support

2 March 2025 - Dapper Part 6 - Returning Multiple Sets Of Results - Dapper Part 6 - Multiple result sets

1 March 2025 - Dapper Part 5 - Passing Data In Bulk To The Database - Dapper Part 5 - Table valued parameters

February 2025

28 February 2025 - Dapper Part 4 - Passing Data To And From The Database - Dapper Part 4 - Passing data between client and server

27 February 2025 - Dapper Part 3 - Executing Queries - Dapper Part 3 - Executing Queries

26 February 2025 - Dapper Part 2 - Querying The Database - Dapper Part 2 - querying the database

25 February 2025 - Simpler .NET Data Access With Dapper - Part 1 - Dapper Part 1

24 February 2025 - How SQL Injection Works - Part 2 - How SQL Injection works - part 2

23 February 2025 - How SQL Injection Works - Part 1 - How SQL Injection works - part 1

22 February 2025 - Using Case Insensitive Dictionary Keys In C# & .NET - How to use case insensitive directory keys.

21 February 2025 - Configuring JSON Responses With ASP.NET - Configuring JSON responses on ASP.NET applications.

20 February 2025 - Enums & Enum Flags In C# & .NET For Dummies - How to use enums

19 February 2025 - Some Useful Integer Helper Methods In .NET - Useful Integer helper methods

16 February 2025 - View Request & Response Headers For HTTP Requests In C# & .NET - Using the DelegatingHandler to log headers

15 February 2025 - Using Frozen Collections For Immutability - Get executing .NET version

14 February 2025 - Getting The Executing .NET Version - Get executing .NET version

12 February 2025 - Using Base64 To Encode Binary Data - Using Base64 to encode binary data

11 February 2025 - Is That String Null, Empty, Or WhiteSpace? - Various ways to check for empty strings

10 February 2025 - Executing Actions In Parallel With Parallel.Invoke - Using Parallel.Invoke to run actions in parallel.

9 February 2025 - Immutable Types In C# & .NET - Immutable types

8 February 2025 - Pipelining Task Results With Task.WhenEach - Using Task.WhenEach

7 February 2025 - Parallelizing Work With C# & .NET - Parallelizing work

6 February 2025 - Using LINQ OfType To Filter Collections By Type - LINQ OfType to filter collections

5 February 2025 - Using Deconstructors In C# - Using Deconstructors In C#

4 February 2025 - Using LINQ Repeat To Generate Copies Of Objects - LINQ Repeat to generate objects.

3 February 2025 - Using LINQ Concat To Merge Collections - LINQ Concat to merge collections.

2 February 2025 - Using LINQ UnionBy To Merge Collections - LINQ UnionBy to merge collections.

1 February 2025 - Scheduling Tasks With The PeriodicTimer - Scheduling tasks with the periodic timer

January 2025

31 January 2025 - Beware - Mapping Classes With ReadOnly Properties Using Dapper With VB.NET, C# & F# - Dapper Issue With ReadOnly Properties in VB.NET

30 January 2025 - Lazy Initialization With System.Lazy - Using System.Lazy for lazy object initialization

29 January 2025 - Using Indexes With LINQ - Accessing collection indexes with LINQ

28 January 2025 - Set Operations With LINQ - Set theory with LINQ

27 January 2025 - Using LINQ Zip To Combine Collections - LINQ Zip to combine collections.

26 January 2025 - Using LINQ Aggregate & AggregateBy To Perform Aggregate Computations - LINQ Aggregate & AggregateBy to perform aggregations

25 January 2025 - Using LINQ SelectMany To Flatten Collections - LINQ SelectMany to flatten collections

24 January 2025 - Using LINQ GroupJoin To Perform Grouped Joins - LINQ `GroupJoin' to perform joins

15 January 2025 - Locale & Culture Support For Kenyan Languages In .NET - Localization Support For Kenyan Languages

14 January 2025 - Validating .NET Settings Part 4 - Validating Using IValidateOptions - Validating settings with IValidateOptions

13 January 2025 - Validating .NET Settings Part 3 - Validating Using Data Annotations - Validating settings with Data Annotations

12 January 2025 - Validating .NET Settings Part 2 - Validating Using FluentValidation - Validating settings with FluentValidation

11 January 2025 - Validating .NET Settings Part 1 - Manual Validation - Manually validating settings

10 January 2025 - Unit Testing Fractional Values In C# & .NET - How to test fractional values

December 2024

31 December 2024 - Dependency Injection In C# & .NET Part 1 - Introduction & Basic Implementation - Dependency Injection Introduction

30 December 2024 - Downloading Files With ASP.NET Core Minimal API - How to download files with Minimal API

29 December 2024 - Uploading Files With ASP.NET Core Minimal API - How to upload files with Minimal API

26 December 2024 - Using The Lock In C# & .NET 9 - how to use locks to write thread-safe code

25 December 2024 - Correctly Processing CSV Files - how to correctly read and write CSV files

22 December 2024 - Caching In .NET Applications & The Hybrid Cache - two cache implementations and the improvements in the HybridCache

11 December 2024 - Loading & Using Application Settings - how to retrieve settings values from an application.

9 December 2024 - Writing Minimal APIs For HEAD Requests - How to write minimal APIs to handle HEAD requests.

November 2024

29 August 2024 - Improved Collection Shuffling In F# 9 - Improvements to collections to support shuffling

28 August 2024 - Truncating Numbers In C# - How to truncate numbers in C#

April 2024

6 April 2024 - Using Inheritance With FluentValidation - How to leverage inheritance to write less, and more powerful, validation code.

August 2023

18 August 2023 - Defining Relationships With Enum Attributes For Enum Values In C# - How to use attributes to enforce relationships between Enums

8 August 2023 - Tip - Using JsonSerializationOptions With Refit - how to control the serialization and deserialization of objects when using Refit

July 2023

21 July - Tip - Adding x-request-id to a HTTP request without changing case - a workaround around a problem where the HttpClient changes the case of this particular header when it is added.

May 2023

3 May 2023 - Writing Maintainable, Testable Code That Depends On The Current Time - how to use interfaces to mock implementations that can be used to improve testing, maintainability and composability of components.

March 2023

28 Mar - How To Use C# List Pattern Matching Practically - How to use List Patterns for the elegant solution of common problems.

February 2023

14 Feb - Building Directory Paths In C# - How to use Path.Combine for better manipulation and building of file system paths.

November 2022

26 Nov - Indexing SQL Server NVARCHAR(MAX) Columns - How to get around restrictions around the indexing of NVARCHAR(MAX) SQL Server database columns.

21 Nov - Deserializing Null Values From JSON - How to do custom deserialization of values in JSON payloads.

12 Nov - The Required Keyword in C# 11 & .NET 7 - How to use the required keyboard to write terser, more maintainable code.

October 2022

24 Oct - Constructing Dates In SQL - SQL Server parse strings in various date formats into valid dates.

15 Oct - Microsecond Precision In .NET - How to handle microsecond precision in .NET and an improved way to do it in .NET 7

14 Oct - How To Order Classes And Records In C# - Using Comparers by implementing the IComparer interface to allow for flexible sorting of collections of classes and records.

13 Oct - Tip - Simpler LINQ Ordering In .NET 7

3 Oct - Tip - Using LINQ To Filter A List Of Strings Containing Words In Another List

2 Oct - Tip - Grouping Using LINQ In VB.NET - A gotcha in the syntax of how to correctly group using VB.NET

August 2022

15 August - A better way to build and maintain URLs

1 August - Using HttpClient To Post JSON In C# & .NET

May 2022

25 May - Mapping Inherited Immutable Classes Using Dapper

April 2022

28 April - Adding Multiple Items To A HashSet In C#

March 2022

29 Mar - Cleaner Code With Switch Expressions In C#

December 2021

21 December - 30 Days Of .NET 6 - Day 30 - Simplified Argument Null Checks - How to simplify code that does checks for null arguments.

6 December - 30 Days Of .NET 6 - Day 29 - Writing Raw JSON Using Utf8JsonWriter - How to customize Json serialization

November 2021

29 November - 30 Days Of .NET 6 - Day 28 - JSON Serialization To & From Streams - How to serialize JSON to a stream and to deserialize JSON from a stream.

19 November - 30 Days Of .NET 6 - Day 27 - Extended Property Patterns - Using extended property patterns to simplify filtering.

4 November - 30 Days Of .NET 6 - Day 23 - Nullable References - How nullable references help catch potential bugs at compile time.

October 2021

27 October - 30 Days Of .NET 6 - Json Property Ordering - How to control the order of the serialization of Json attributes

21 October - Saving Collections Of Primitives In Entity Framework Core - How to persist collections of primitive in Entity Framework Core

21 October - 30 Days Of .NET 6 - Day 19 - Record Structs - .NET 6 has a new record struct construct where record execution is applied to structs.

12 October - 30 Days Of .NET 6 - Day 17 - New Timer - PeriodicTimer - .NET 6 has a new timer for use in async contexts - the PeriodicTimer

7 October - 30 Days Of .NET 6 - Day 16 - HTTP/3 Support - .NET 6 now supports HTTP/3

5 October - 30 Days Of .NET 15 - Day 10 - SOCKS Proxy Support - You can now connect using SOCKS 4 and 5 proxy servers

September 2021

29 September - 30 Days Of .NET 6 - Day 13 - LINQ Improvements - Chunk - You can use the new Chunk method to partition collections into multiple collections of a specified size.

28 September - 30 Days Of .NET 6 - Day 12 - Collection Count Performance Check - TryGetNonEnumeratedCount - a new method intended to allow you to check if you can cheaply determine the size of a collection.

27 September - 30 Days Of .NET 6 - Day 11 - LINQ Improvements - Support For Ranges - LINQ now allows you to use indexes and ranges in expressions.

22 September - 30 Days Of .NET 6 - Day 9 - LINQ Improvements - DistinctBy - The DistinctBy extension method.

21 September - 30 Days Of .NET 6 - Day 8 - Control Of Serialization Of Object Cycles - You have additional control of how circular objects are serialized with the System.Text.Json serializer

14 September - 30 Days Of .NET 6 - Day 7 - Simpler Web Application Development - it is now simpler to write web applications using the minimal API feature set.

13 September - 30 Days Of .NET 6 - Day 6 Priority Queue - the new PriorityQueue class

10 September - 30 Days Of .NET 6 - Day 5 - Math API Additions - there have been some additions to the Math class.

9 September - 30 Days Of .NET 6 - Day 4 - LINQ Improvements - MaxBy & MinBy - LINQ improvements - the MaxBy and MinBy extension methods

8 September - 30 Days Of .NET 6 - Day 3 - TimeOnly - A look at the new TimeOnly type.

6 September - 30 Days Of .NET 6 - Day 1 - DateOnly - A look at the new DateOnly type.

July 2021

29 July - Reducing Bugs Through Better Domain Design - How to reduce bugs and improve re-usability and maintainability from better domain design.

25 July - Better Assertion Testing With FluentAssertions - Write cleaner, easier to understand tests that can be read by users of other testing frameworks

2 July - F# Doesn't Support C# Types Using Init Modifiers - Interop from C# fails when you use the init property modifier.

June 2021

11 June - Tip - TimeSpan Minutes vs TotalMinutes - The difference between Minutes and TotalMinutes when subtracting TimeSpans is very subtle.

May 2021

24 May -About Default Interfaces - Application of C# default interface methods

March 2021

24 Mar - Using System.Text.Json To Enforce API Logic - How use System.Text.Json To Enforce API Logic

9 Mar - Handling Nulls & Empty Strings With System.Text.Json - Your options when it comes to handling nulls & empty strings with the System.Text.Json engine.

6 Mar - Inheritance In Business Logic Is Likely A Code Smell - Part 1 - If you are using class inheritance to solve business problems, you are likely doing something wrong.

February 2021

2 Feb - Using Regex MatchEvaluators - how to use regular expression match evaluators to solve interesting problems

December 2020

30 December 2020 - What Do You Actually Agree To When You Accept Cookies - the implications of data collection and the potential organizations with access to it.

21 December 2020 - Improving HttpClient Requests - improving http redirection management with the HttpClient

14 December 2020 - HTTP Header Validation - potential problems that can be caused from failing to set HTTP Headers

November 2020

23 November 2020 - HTTP Redirects using HttpClient - a closer look at how http redirects are handled by the HttpClient

21 November 2020 - Refactoring With Records - Refactoring code to use the record construct introduced in C# 9

12 November 2020 - Conditional Logic In MSBuild - using MSBuild to control the build process and output notifications

9 November 2020 - Getting Now Playing Information From WQXR In .NET - Reverse engineering getting the now playing information from the WXQR radio station using the API

June 2020

25 June - Joining Strings - Part 3 - Joining strings using the StringBuilder

15 June - Joining Strings - Part 2 - Joining strings using String.Concat

May 2020

28 May - Joining strings - part 1 Concatenation with the + operator

19 May - Using curl in PowerShell - how to use the curl utility without clashing with the PowerShell alias

16 May - Touch In PowerShell - Implementing the Touch command in PowerShell

April 2020

25 April - Extracting Bytes From a F# String - A quick way to extract the bytes from a string

14 April - Count vs Length vs Any–Checking Collection Emptiness - The various ways of checking a collection is empty and bench-marking their performance

10 April - Properties Under The Hood - what does the compiler do when it finds properties in your code?

5 April - Argument Handling Across Paradigms - How arguments are handled in C# vs Lisp, and how to get the same effect

1 April - Fizz Buzz In F# - An initial attempt at FizzBuzz and subsequent refinements

March 2020

29 March - Using Nuget In F# Scripts - With F# 4.7 you can use Nuget packages in your scripts

22 March - Fun With Tuples In C# 7 & Above - What tuples are and a clever way to use them in constructors

About

Code from my blog - https://conradakunga.com/blog

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •  
0