@@ -200,7 +200,7 @@ public T AddResource<T>(string key, T resource)
200
200
/// <returns>True if the resource exists, false otherwise</returns>
201
201
public bool TryGetResource < T > ( string key , out T resource )
202
202
{
203
- if ( _resources != null && _resources . TryGetValue ( key , out var objResource ) && objResource is T tResource )
203
+ if ( _resources is not null && _resources . TryGetValue ( key , out var objResource ) && objResource is T tResource )
204
204
{
205
205
resource = tResource ;
206
206
return true ;
@@ -234,7 +234,7 @@ public T GetResource<T>(string key)
234
234
/// <returns>The resource that was removed, if any</returns>
235
235
public T RemoveResource < T > ( string key )
236
236
{
237
- if ( _resources != null && _resources . TryGetValue ( key , out var objResource ) )
237
+ if ( _resources is not null && _resources . TryGetValue ( key , out var objResource ) )
238
238
{
239
239
_resources . Remove ( key ) ;
240
240
if ( objResource is T resource )
@@ -255,7 +255,7 @@ public T RemoveResource<T>(string key)
255
255
public T RemoveAndDisposeResource < T > ( string key )
256
256
where T : IDisposable
257
257
{
258
- if ( _resources != null && _resources . TryGetValue ( key , out var objResource ) )
258
+ if ( _resources is not null && _resources . TryGetValue ( key , out var objResource ) )
259
259
{
260
260
_resources . Remove ( key ) ;
261
261
if ( objResource is T resource )
@@ -309,7 +309,7 @@ internal T RemoveAndDisposeResource<T>(TypedResourceKey<T> key)
309
309
/// </summary>
310
310
public void ClearAndDisposeResources ( )
311
311
{
312
- if ( _resources != null )
312
+ if ( _resources is not null )
313
313
{
314
314
foreach ( var kvp in _resources )
315
315
{
0 commit comments