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);
}
}
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme