.NET DirectoryInfo Question

All,

I am trying to get the folder name of a directory using the .NET implmentation of the DirectoryInfo Class. Within that class, there is a property called Name which is the one I want. I need that to do actions against a SQL Server to retrieve data.

DirectoryInfo(“C:\LV”).Name

image

When I try to impliment this, I get that the DirectoryInfo is a type and cannot be used in an expression.

you need to instantiate it
new DirectoryInfo(“C:\LV”).Name

Thank you! I knew I was missing something simple.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.