以下の内容はhttps://baba-s.hatenablog.com/entry/2015/07/17/100000より取得しました。


【C#】配列やリストが空かどうかを返す拡張メソッド

ソースコード

using System.Collections.Generic;

public static class IListExtensions
{
    public static bool IsEmpty<T>( this IList<T> self )
    {
        return self.Count == 0;
    }
}

使い方

var x = new int[ 0 ];
var y = new int[ 1 ];
x.IsEmpty(); // True
y.IsEmpty(); // False

関連記事




以上の内容はhttps://baba-s.hatenablog.com/entry/2015/07/17/100000より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14