❔ list patterns net 7

any use case of List patterns in project? , can we use List<T>?
4 Replies
cathei
cathei2y ago
List<int> numbers = new() { 1, 2, 3 };

if (numbers is [var first, _, _])
{
Console.WriteLine($"The first element of a three-item list is {first}.");
}
List<int> numbers = new() { 1, 2, 3 };

if (numbers is [var first, _, _])
{
Console.WriteLine($"The first element of a three-item list is {first}.");
}
Yes
sagarviradiya
sagarviradiya2y ago
Can you share example of List. and any real scenarios which can be used in project?
ero
ero2y ago
Is the example they gave not sufficient?
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.