Kok Keong Chua

Kok Keong Chua

  • NA
  • 15
  • 21k

Difference between class & type

May 6 2011 12:31 AM
Hi all,
I'm a newbie in C#, appreciated if someone can clear my doubt on the class & type:

DirectoryInfo is a .net class, we need to instantiate an object to use it as below:

string path = @"C:\My Folder";
DirectoryInfo di = new DirectoryInfo(path);


However, why we also can use this class as a type as shown below:
DirectoryInfo parent = Directory.GetParent(path);



Answers (4)