Skip to content
Sven Hübner IT
  • Home
  • Blog

C#

  • Home
  • Blog
  • C#

Gotcha with .globalconfig and Visual Studio

Posted by By sven.huebner.it April 1, 2023Posted inBuild, General Development
VS will always apply a `.globalconfig`, not just when analyzers are activated like the CLI build does. Use a different name and explicit inclusion to get consistent behavior.
Read More

Fun with generics: mapping a generic instance from a non-generic reference

Posted by By sven.huebner.it March 5, 2023Posted inGeneral Development
DDD can lead to dealing with non-generic references to generic instances of types. Generically mapping these instances or generically calling code with them is not straightforward. I present how it can nonetheless be unobtrusively achieved with a general visitor-like pattern.
Read More

Advanced MSBuild: project file as single source of truth for build and runtime

Posted by By sven.huebner.it November 19, 2022Posted inBuild, General Development
It is possible to define build parameters in a way that is accessible at runtime by declaring custom AssemblyAttribute entries in your csproj file.
Read More

Fun with generics: building a generic call without reflection

Posted by By sven.huebner.it November 12, 2022Posted inGeneral Development
DDD can lead to generic types that are hard to import to. This technique can be used to make a generic call with multiple type arguments when each type argument is supplied individually, e. g. from an import into a domain model.
Read More

Advanced MSBuild: Introduction

Posted by By sven.huebner.it October 15, 2022Posted inBuild
Knowing MSBuild can help you remove code duplication, enforce consistency in a large repo and improve developer experience.
Read More

The pain of using Excel files for user input

Posted by By sven.huebner.it October 8, 2022Posted inUncategorized
In 2022, reading Excel files in C# is still a pain and can require intricate knowledge of XLSX, even when using a library like NPOI.
Read More

Just for fun: changing runtime behavior with unreachable code

Posted by By sven.huebner.it October 1, 2022Posted inUncategorized
Unreachable code can still change compiler behavior and thus runtime method behavior. An example with `yield`.
Read More

Be more productive with more keystrokes: use named Regex capture groups

Posted by By sven.huebner.it September 24, 2022Posted inGeneral Development, Uncategorized
Use named capture groups when parsing with regular expressions to make the Regex self-contained and the matching code more readable.
Read More

Nuget Packaging Series 2: Beware of DLL version conflicts

Posted by By sven.huebner.it July 10, 2022Posted inBuild
Putting assemblies with different TFMs in the same nuget package can lead to runtime assembly loading errors because of transitive assembly reference version conflicts.
Read More

Closed Type Hierarchies with records … NOT!

Posted by By sven.huebner.it February 23, 2022Posted inGeneral Development1 Comment
TL;DR: You cannot create closed type hierarchies with record types because of the generated protected copy constructor.
Read More

Posts pagination

1 2 3 Next page
Copyright 2025 — Sven Hübner IT. All rights reserved. Sinatra WordPress Theme
Scroll to Top