0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Linqで迷った処理メモ

Last updated at Posted at 2025-04-02
class Idol
{
    public required string Name { get; set; }
    public int Age { get; set; }
    public required string Production { get; set; } 
}

class Program
{
    static void Main()
    {
        List<Idol> idols =
        [
            new() { Name = "天海春香", Age = 17, Production = "765" },
            new() { Name = "日高愛", Age = 13, Production = "876" },
            new() { Name = "島村卯月", Age = 17, Production = "346" },
            new() { Name = "春日未来", Age = 14, Production = "765" },
            new() { Name = "萩原雪歩", Age = 17, Production = "765" },
        ];

        //条件を満たす間だけ値を取り出す
        var selected = idols.TakeWhile(x => x.Age <= 15);
    }
}
0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?