I have a C# programme like as follows. But it fails.
Error is ‘System.IO.FileSystemInfo.FullPath’ is inaccessible due to its protection level.
And FullPath underlined in blue.
protected void Main(string[] args)
{
DirectoryInfo parent = new DirectoryInfo(@"C:\Users\dell\Desktop\rename");
foreach (DirectoryInfo child in parent.GetDirectories())
{
string newName = child.FullPath.Replace('_', '-');
if (newName != child.FullPath)
{
child.MoveTo(newName);
}
}
}
The property that you are looking for is called
FullName, notFullPath: