Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redundant containskey #156

Merged
merged 2 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions src/Alba/Internal/LightweightCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,7 @@ public TValue this[TKey key]
}
set
{
if (_values.ContainsKey(key))
{
_values[key] = value;
}
else
{
_values.Add(key, value);
}
_values[key] = value;
}
}

Expand Down Expand Up @@ -128,15 +121,7 @@ public void Fill(TKey key, TValue value)

public bool TryRetrieve(TKey key, [MaybeNullWhen(false)] out TValue value)
{
value = default;

if (_values.ContainsKey(key))
{
value = _values[key];
return true;
}

return false;
return _values.TryGetValue(key, out value);
}

public void Each(Action<TValue> action)
Expand Down
3 changes: 1 addition & 2 deletions src/IdentityServer.New/Pages/Diagnostics/ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ public ViewModel(AuthenticateResult result)
{
AuthenticateResult = result;

if (result.Properties.Items.ContainsKey("client_list"))
if (result.Properties.Items.TryGetValue("client_list", out var encoded))
{
var encoded = result.Properties.Items["client_list"];
var bytes = Base64Url.Decode(encoded);
var value = Encoding.UTF8.GetString(bytes);

Expand Down
Loading