Here[
^] is the MSDN page for DirectoryInfo class. This page has an excellent example on how to use it. You should book mark the
MSDN Homepage[
^] for future reference, and your first option, if you don't know how to do something, should always be to open that page and search for what you need. You will learn things much quicker that way, as well as learning the proper way to do things.
Hope it helps you.