Tag Archives: .NET

.NET: Convert a Byte Array to String

A short snippet which converts a byte array to a string, and which handles conversion of the byte order mark (BOM). As seen, the byte order mark bytes are excluded from the conversion, which if they are left in, could cause problems when attempting to use the string, particularly if the string is an Xml […]

Read more

Regular Expressions Reference

Here’s a set of great references for using Regular Expressions; Part 1 Part 2 Part 3

Read more

.NET: Customizing XML Object Serialization

Serializing C# objects using the .NET framework is a simple task, as is shaping the XML which results from serializing a C# object in terms of XML elements, attributes and namespaces. However, whats not so straightforward, or at least sparsely documented, is controlling what if any namespace and Xml declarations are emitted during serialization. The […]

Read more

C#: Implementing Generic Method of Generic Interface Causes Runtime Exception

You have an interface declaration which includes a method signature that has a generic parameter and generic constraints. Such an interface can be seen below; And you also have a implementation class, as shown; This compiles perfectly fine. At runtime however, if you attempt to instanciate the implementation class you will receive an Exception; “Method XXX […]

Read more

C#: Interruptable Background Processing Service

Working on a prototype this week I needed a console app to create and start a periodic background processing activity, then sit waiting while the background processing activity executed every X seconds, untill you pressed the Ctrl+C key, which stopped the background processing and terminated the application. Ok, so I needed; A background thread to […]

Read more
Follow

Get every new post delivered to your Inbox.

Join 426 other followers