Nooks and Crannies – Programming Language Curiosities – C# 3
Nooks and Crannies explores some interesting techniques and methods that are specific to a given language. While these techniques may not be useful in everyday development they could come in handy in niche application and scenarios. Word of warning though; the fact that these techniques could be considered obscure should warrant a second thought before they are included in production code.
Unions
A popular technique I used often when developing system communication modules in C; this allows us to reference the same section of memory as different formats. Commonly this is used to handle transitions between little-endian and big-endian systems or manipulate byte level data (for say IP address modeling).
(more…)