Tag Archives: C#

Localization / Globlization on the fly

Have you ever wondered about creating and editing .resx resources files at runtime ? Let’s say you build an application supporting globalization/localization and the values of some of your items is not known upfront. In this case, we’ll assume that you allow the end-user to create his own resources entries that will be used at […]

Generate a random string

If you’ve ever wanted to generate some random strings, here is a piece of code that can be helpful at times. Note that you can supply any other content for the array to choose the new string’s characters from.   private string GenerateRandomString(int length)         {             Char[] allowedChars = GetPrintableCharacters();             char[] chars = […]

C# 4.0 Option argument corner cases…By Eric Lippert

For all of your working with C# 4.0, you’ve surely been using optional arguments in order to define specific constants that can be used when calling a method if certain arguments are omitted. Interestingly enough, this functionality does not come ‘for free’ and Eric Lippert, a developer in the C# compiler team has written four […]