StyleCop type members layout for ReSharper

Resharper’s code cleanup (CTRL+E,CTRL+C) has a handy option which reorders your type members for you. However the predefined reordering rules might not suit your needs. If you like StyleCop’s stricter ruleset, then this is your lucky day. Go to RESHARPER -> OPTIONS, and then CODE EDITING -> C# -> TYPE MEMBERS LAYOUT. Select the “Custom layout” radio button and paste in the following XML.

[C#] Remove diacritics (accents) from a string

Removing diacritics from a string is a common task that doesn’t have a built-in method in the .NET framework. Luckily, it’s really easy to write an extension method which will do the trick. Here is how it’s done.

Unicode and UTF - What you need to know

What is Unicode?

Calculate the best text colour for a given background

At one point or another you may find yourself in the situation of having to display text on a background whose colour is chosen by the user of your application. Should this happen to you, one of the first problems that will come to mind is how to ensure that the text always remains readable. Well, there is an easy way to do this. With a little math, you can simply go about calculating the relative brightness of the chosen colour and subsequently determine whether white or black text will provide optimum contrast. Sound easy? It is! Let’s look at how it’s done.