Ошибка CS7036. Error cs7036
Не могу решить вопрос с ошибкой CS7036. Пытался без конструктора, но результат не отличается. Я понимаю что в методы должно необходимо внести аргумент(string dirWay), но пользователь сам вносит url. Просьба объяснить подробнее.
using System; using System.IO;
namespace Programm {
class Programm
{
public string DirWay;
public Programm(string dirWay)
{
DirWay = dirWay;
}
public static void Main(string[] args)
{
Console.WriteLine("Enter URL of directory");
RequestUrl();
Programm p = new Programm("fg");
p.DirDelete(); // cs7036
p.DiLength(); // cs 7036
}
public static string RequestUrl()
{
string dirWay = Console.ReadLine();
return dirWay;
}
public void DiLength(string dirWay)
{
DirectoryInfo dir = new DirectoryInfo(dirWay);
FileInfo[] fileArr = dir.GetFiles();
foreach (FileInfo f in fileArr)
Console.WriteLine("The size of {0} is {1} bytes.", f.Name, f.Length);
}
public void DirDelete(string dirWay)
{
DirectoryInfo dirInfo = null;
try
{
dirInfo = new DirectoryInfo(dirWay);
dirInfo.Delete(true);
Console.WriteLine("Directory delete");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
Источник: Stack Overflow на русском