Tag:csharp
All the articles with the tag "csharp".
T4 Runtime Template and code-behind logic
How to add a code-behind partial class to a T4 runtime template by manually editing the csproj file, with a Visual Studio add-in.
Read more…T4 Templates and Null in Expression block
T4 templates throw ArgumentNullException on null expression blocks; fix by overriding ToStringWithCulture in the base class.
Read more…Useful Dictionary extensions I am always using
Two reusable C# IDictionary extension methods: GetValueOrDefault and GetOrAddValue with a factory function.
Read more…T4 Runtime Templates Base Class
Demonstrates extracting T4 runtime template auto-generated base class into a shared reusable C# base class for all templates.
Read more…T4 Syntax
Overview of T4 template syntax including directives, text blocks, control blocks, expression blocks, and class feature blocks.
Read more…Developing Custom Tool (aka Single File Generators) for Visual Studio 2012
Step-by-step guide to creating and registering a COM-visible Single File Generator custom tool for Visual Studio 2012.
Read more…WTF Generic attributes in C_
C# CLR limitation prevents generic types from deriving from Attribute, causing a CS0698 compile error.
Read more…WTF Exception.ToString() and FaultException
FaultException inner details are silently dropped by Exception.ToString(); an extension method restores the full fault message.
Read more…Nullable types, lifted operators and ReSharper
Explains C# lifted operators with nullable types and a ReSharper false-positive bug when assigning nullable int to a class with implicit operator.
Read more…Test SyntaxHighlight
Test post confirming SyntaxHighlighter integration works on Blogger with a C# code sample.
Read more…