Just sharing my code… Output 50 unique reference numbers for anything you might want reference numbers for

It’s nothing special but I thought it might be useful to someone some time…

using System; using System.Collections.Generic; using System.Linq; public class Program { private static List<string> _items = new List<string>(); public static void Main() { for (int i = 0; i <= 50; i++) { // Generate a Guid and split it into different parts. var guidString = Guid.NewGuid().ToString(); var strArr = guidString.Split('-'); // I only want a result that's 6 characters long. var refNo = strArr[0].SubString(0, 6); // Write the new reference number to the list. if (!iems.Any(x => x == refNo)) { _items.Add(refNo); } } } } 

submitted by /u/ortund
[link] [comments]

Leave a Reply