---
# System prepended metadata

title: C# `.NET 8` パフォーマンス重視型 Frozen collections `FrozenDictionary` 2023-02-27
tags: [C#, Frozen collections, .NET 8, FrozenDictionary]

---

---
lang: ja-jp
breaks: true
---
# C# `.NET 8` パフォーマンス重視型 Frozen collections `FrozenDictionary` 2023-02-27

> .NET 8 Preview 1 出た
> https://youtu.be/Kai58qBvaVA?t=4542

> Performance-focused types
> https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8#performance-focused-types


```csharp=
private static readonly FrozenDictionary<string, bool> s_configurationData =
    LoadConfigurationData().ToFrozenDictionary(optimizeForReads: true);
// ...
if (s_configurationData.TryGetValue(key, out bool setting) && setting)
{
    Process();
}
```

> runtime/src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/
> https://github.com/dotnet/runtime/tree/main/src/libraries/System.Collections.Immutable/src/System/Collections/Frozen

###### tags: `C#` `.NET 8` `Frozen collections` `FrozenDictionary`
