I have this loop:
foreach (DirectoryInfo dir in downloadedMessageInfo.GetDirectories()) { if (dir.Attributes != FileAttributes.Hidden)
This code works for me in VB.Net;
If (dir.Attributes.Tostring.Contains("Hidden") Then ' File is hidden Else ' File is not hidden EndIf