Skip to content

Commit

Permalink
Fix compile error.
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-drewery committed Jul 12, 2023
1 parent 370d6c6 commit ff3eb4f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion content/registry-of-singletons.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ Hey presto! It works just like an enum. In fact, sometimes people might not even
Sometimes we want to expose our list of countries as an `IEnumerable` and be able to look them up by name. This is easy to do with a static property that uses reflection:

```csharp
public static IDictionary<string, Country> All => this.GetType().GetProperties(BindingFlags.Public | BindingFlags.Static)
public static IDictionary<string, Country> All => typeof(Country)
.GetProperties(BindingFlags.Public | BindingFlags.Static)
.Where(p => p.PropertyType == typeof(Country))
.Select(p => p.GetValue(null))
.Cast<Country>()
Expand Down

0 comments on commit ff3eb4f

Please sign in to comment.