I am tring to use a method or function to create the directory tree that I need, and return the new path to the calling procedure.
But I cannot get it to compile
I get an error cannot convert method group 'localAttachmentsPath' to non delegate type string ..
here is my code - what have I done wrong? And is there a better way to accomplish this?
private string localAttachmentsPath(ref string emailAttachmentsPath)
{
string sYear = DateTime.Today.Year.ToString();
string sMonth = DateTime.Now.ToString("MMMM");
string sDirectoryDate = DateTime.Today.ToString("dd.MM.yyyy");
if (!Directory.Exists(emailAttachmentsPath))
{
Directory.CreateDirectory(emailAttachmentsPath);
}
emailAttachmentsPath = emailAttachmentsPath + "\\" + sYear;
if (!Directory.Exists(emailAttachmentsPath))
{
Directory.CreateDirectory(emailAttachmentsPath);
}
emailAttachmentsPath = emailAttachmentsPath + "\\" + sMonth;
if (!Directory.Exists(emailAttachmentsPath))
{
Directory.CreateDirectory(emailAttachmentsPath);
}
emailAttachmentsPath = emailAttachmentsPath + "\\" + sDirectoryDate;
if (!Directory.Exists(emailAttachmentsPath))
{
Directory.CreateDirectory(emailAttachmentsPath);
}
//localAttachmentsPath = emailAttachmentsPath;
return localAttachmentsPath;
}