// 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; using System.Net; namespace E { public class Program { public static string MaskBefore1985(string net) { int first = IPAddress.Parse(net).GetAddressBytes()[3]; if(first < 128) { return "255.0.0.0"; } else if(first < 192) { return "255.255.0.0"; } else { return "255.255.255.0"; } } public static void Main(string[] args) { string mask = MaskBefore1985("15.20.10.0"); Console.WriteLine(mask); } } }