Files
dotnet-bot a026243bcc Adding System.Compo... System.Ident... System.Numer... System.Runti...
Adding reference source for
System.ComponentModel.DataAnnotations
System.IdentityModel
System.IdentityModel.Selectors
System.Numerics
System.Runtime.Caching
System.Runtime.Serialization
2016-05-03 00:07:38 +02:00

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;
}
}
}
}