e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
//------------------------------------------------------------
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//------------------------------------------------------------
|
|
using System.Collections.Generic;
|
|
|
|
namespace System.IdentityModel.Metadata
|
|
{
|
|
/// <summary>
|
|
/// A sorted list of <see cref="IndexedProtocolEndpoint"/>.
|
|
/// </summary>
|
|
public class IndexedProtocolEndpointDictionary : SortedList<int, IndexedProtocolEndpoint>
|
|
{
|
|
/// <summary>
|
|
/// Gets the default <see cref="IndexedProtocolEndpoint"/>.
|
|
/// </summary>
|
|
public IndexedProtocolEndpoint Default
|
|
{
|
|
get
|
|
{
|
|
IndexedProtocolEndpoint impliedDefault = null;
|
|
foreach (KeyValuePair<int, IndexedProtocolEndpoint> kvp in this)
|
|
{
|
|
if (kvp.Value.IsDefault == true)
|
|
{
|
|
return kvp.Value;
|
|
}
|
|
if (kvp.Value.IsDefault == null && impliedDefault == null)
|
|
{
|
|
impliedDefault = kvp.Value;
|
|
}
|
|
}
|
|
|
|
if (impliedDefault != null)
|
|
{
|
|
return impliedDefault;
|
|
}
|
|
|
|
if (this.Count > 0)
|
|
{
|
|
return this[this.Keys[0]];
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|