select random string from an array in c#

using System;

namespace ajayvishu
{
select random string from an array in c#    public class Program
    {
        public static void Main(string[] args)
        {
            var dt=Getval();
            Console.WriteLine(dt);
        }
        public static string Getval(){
            string[] developers = { "AJAY", "HEMANT", "HETVI", "KINJAL", "ANY", "JUHI", "PALAK", "BHAVIN", "HINAL", "MAITRY" };
            Random rand = new Random();
            int index = rand.Next(developers.Length);
            return developers[index];
        }
    }
}

Post a Comment

0 Comments