Tag:csharp
All the articles with the tag "csharp".
Coding Standards document
A concise C# coding standards document with ReSharper configuration, covering access modifiers, var usage, and best practices.
Read more…Escaping Invalid XML Unicode characters
Step-by-step derivation of a C# regex to strip or escape characters invalid in XML, handling UTF-16 surrogate pairs correctly.
Read more…Stripping invalid characters from UTF-16 strings
C# regex approach to remove unpaired UTF-16 surrogate characters from strings to ensure valid Unicode output.
Read more…The best debugging technique - inverse breakpoint
Using Debugger.Launch and Debugger.Break in C# code to attach a debugger to hard-to-reach processes like Visual Studio plugins.
Read more…C__PowerShell Clipboard Watcher
Implements a clipboard change watcher in PowerShell using inline C# with P/Invoke and WinForms WM_CLIPBOARDUPDATE.
Read more…WTF Method overloads resolution in PowerShell
PowerShell resolves .NET method overloads differently from C#, causing unexpected method calls with bool arguments.
Read more…Indent styles holy wars
Discussion of Allman vs K&R brace styles across C#, JavaScript, CSS, and PowerShell.
Read more…obj.ToString(), nulls and ReSharper
ReSharper incorrectly marks ToString() as non-nullable, but BCL types like HtmlString can return null.
Read more…WCF _ useless ProtocolException
WCF ProtocolException truncates the server error response; an extension method on WebException extracts the full response body.
Read more…T4 Design-Time templates base class
How to create a shared custom base class for T4 design-time templates by extending TextTransformation, with a working example.
Read more…