So being the beacon of ignorance in the fog of brilliance, I had no idea what Duck Typing was. In short it’s the idea of assuming a class’s type based on the methods it holds. Say you have 5 different classes, none of which share an inheritance tree. Now let’s say you have a method [...]
Tag Archives: String
Random String of Specified Length with Enumerable
using System; using System.Collections.Generic; using System.Linq; using System.Text; public static String RandomString(Int32 length) { Random randomGenerator; String returnValue; randomGenerator = new Random(); returnValue = new string(Enumerable.Range(0, length).Select(i => (char)(‘A’ + randomGenerator.Next(0, 25))).ToArray()); return returnValue; } What this does: Enumerable.Range basically says, “Give me a collection of numbers from the first parameter to the second”, or [...]