以下の内容はhttps://baba-s.hatenablog.com/entry/2022/08/23/144742より取得しました。


【C#】条件を満たす場合にのみ Prepend する拡張メソッド

概要

using System.Collections.Generic;
using System.Linq;

namespace Kogane
{
    public static class EnumerableExtensionMethods
    {
        public static IEnumerable<T> PrependIf<T>
        (
            this IEnumerable<T> self,
            bool                conditional,
            T                   element
        )
        {
            return !conditional ? self : self.Prepend( element );
        }
    }
}



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

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