Commit 027ae25
committed
Introduced
When adding a type, it is conceivable that a class being derived from has already added that type. For this reason, most derivatives of `StaticTypeLookupService` implement local checks to avoid a key conflict.
Since this is such a common scenario, that logic is being centralized as a `TryAdd()` method. This method will add the `Type` if no `Type` with the same key exists. Otherwise, it will simply return `false`, instead of throwing an exception. If an exception is preferred in this scenario, the existing `Add()` method will satisfy that condition.
This complements the newly added `AddOrReplace()` method, which will replace the existing `Type` if it exists (cd92791).TryAdd()
1 parent cd92791 commit 027ae25
1 file changed
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
98 | 114 | | |
99 | 115 | | |
100 | 116 | | |
| |||
0 commit comments