I need to go through various directories on the computer (via DirectoryInfo). Some of them aren\'t accessible, and UnauthorizedAccessException occurs. How can I check direct
Simply put you can't. There is no way to check if a directory is accessible, all you can determine is that it was accessible. The reason why is as soon as the check completes the permissions can changed and invalidate your check. The most reliable strategy you can implement is to access the directories and catch the UnauthorizedAccessException.
I wrote a blog article on this subject recently which goes into a bit of detail here