I am new to C#, I want to initialise string of arrays dynamically, how can I achieve it? i.e. first I initialised…
string[] filepaths;
public void btnGetFiles_Click(object sender, EventArgs e)
{
try
{
filepaths[] = Directory.GetFiles(@txtGetFile.Text,"*.txt");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
In filepaths[]it is not getting the directory files. Please help..
This is wrong:
Remove the brackets and the (optional) @ symbol from the control name:
filepathsis your variable name, so you address it by that.