using System.Collections.Generic;
public static void Main()
string[] names = { "ashish", "abc", "xyz", "sdsd" };
ref string name = ref names[1];
Console.WriteLine("name : " + name);
Console.WriteLine("all names: \n"+ string.Join(",",names));
List<string> names2 = new List<string>() { "ashish", "abc", "xyz", "sdsd" };
static ref string Find(string[] names, string name)
for (int i=0; i < names.Length; i++)
if (names[i].Equals(name))
throw new Exception("name not found");