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

▶ IEnumerable<T> 인터페이스 : NULL 또는 비어있는지 여부 구하기 예제

List<int> sourceList = new List<int> { 10, 20, 30 };

Console.WriteLine(IsNullOrEmpty(sourceList));

 

728x90

 

▶ IEnumerable<T> 인터페이스 : NULL 또는 비어있는지 여부 구하기

#region NULL 또는 비어있는지 여부 구하기 - IsNullOrEmpty<T>(sourceEnumerable)

/// <summary>
/// NULL 또는 비어있는지 여부 구하기
/// </summary>
/// <typeparam name="TElement">요소 타입</typeparam>
/// <param name="sourceEnumerable">소스 열거 가능형</param>
/// <returns>NULL 또는 비어있는지 여부</returns>
public bool IsNullOrEmpty<TElement>(IEnumerable<TElement> sourceEnumerable)
{
    return sourceEnumerable == null || !sourceEnumerable.Any();
}

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

댓글을 달아 주세요