첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
------------------------------------------------------------------------------------------------------------------------------------------------------
728x90
728x170

■ FileAttributes 클래스를 사용해 디렉토리 여부를 구하는 방법을 보여준다.

 

▶ FileAttributes 클래스 : 디렉토리 여부 구하기 예제 (C#)

Console.WriteLine(IsDirectory("c:\\Windows"));

 

▶ FileAttributes 클래스 : 디렉토리 여부 구하기 (C#)

using System.IO;

#region 디렉토리 여부 구하기 - IsDirectory(source)

/// <summary>
/// 디렉토리 여부 구하기
/// </summary>
/// <param name="source">소스 문자열</param>
/// <returns>디렉토리 여부</returns>
public bool IsDirectory(string source)
{
    FileAttributes attribute = File.GetAttributes(source);

    if((attribute & FileAttributes.Directory) == FileAttributes.Directory)
    {
        return true;
    }
    else
    {
        return false;
    }
}

#endregion
728x90
그리드형(광고전용)
Posted by icodebroker
,