// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; namespace Arne { public class NumException : Exception { public NumException(string s) : base(s) { } } public class NumGen { private static Random rng = new Random(); public static int GenOne() { int num = rng.Next(10); if(num == 0) { throw new NumException("Oops we got a zero"); } return num; } } }