VB.NET
Dim di As New System.IO.DirectoryInfo("C:\test")
If (di.Attributes And System.IO.FileAttributes.Hidden) = _
System.IO.FileAttributes.Hidden Then
Console.WriteLine("隠し属性があります。")
End If
di.Attributes = di.Attributes Or System.IO.FileAttributes.Hidden
di.Attributes = di.Attributes And Not System.IO.FileAttributes.Hidden
C#
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(@"C:\test");
if ((di.Attributes & System.IO.FileAttributes.Hidden) ==
System.IO.FileAttributes.Hidden)
{
Console.WriteLine("隠し属性があります。");
}
di.Attributes |= System.IO.FileAttributes.Hidden;
di.Attributes &= ~System.IO.FileAttributes.Hidden;