عنوان:

‫Frozen collections در NET 8.0.


نویسنده: سیروان عفیفی
تاریخ: ۱۴۰۱/۰۹/۲۲ ۱۹:۳۵
آدرس: www.dntips.ir
List<int> normalList = new List<int> { 1, 2, 3 };
ReadOnlyCollection<int> readonlyList = normalList.AsReadOnly();
FrozenSet<int> frozenSet = normalList.ToFrozenSet();
ImmutableList<int> immutableList = normalList.ToImmutableList();

normalList.Add(4);

Console.WriteLine($"List count: {normalList.Count}");
Console.WriteLine($"ReadOnlyList count: {readonlyList.Count}");
Console.WriteLine($"FrozenSet count: {frozenSet.Count}");
Console.WriteLine($"ImmutableList count: {immutableList.Count}");




مشاهده مطلب اصلی