If anyone can point out where I'm going wrong .
public string GenerateName(char gender)
{
string name;
Random rand = new Random();
if (gender == 'm')
{
string[] maleNames = File.ReadAllLines(Directory.GetCurrentDirectory() + @"\ModifiedMalesNamesList.txt");
string[] lastNames = File.ReadAllLines(Directory.GetCurrentDirectory() + @"\ModifiedLastNamesList.txt");
name = maleNames[rand.Next(0, maleNames.Length - 1)] + " " + lastNames[rand.Next(0, lastNames.Length - 1)];
return name;
}
else
{
}
return name;
}
The compiler says unassigned local variable. Thanks in advance