You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@@ -0,0 +1,47 @@
|
||||
// <copyright>
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace System.ServiceModel.Channels
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal static class EndpointSettings
|
||||
{
|
||||
internal const string ValidateOptionalClientCertificates = "wcf:HttpTransport:ValidateOptionalClientCertificates";
|
||||
|
||||
internal static T GetValue<T>(BindingContext context, string name, T defaultValue)
|
||||
{
|
||||
if (context == null ||
|
||||
context.BindingParameters == null ||
|
||||
context.BindingParameters.Count == 0)
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return GetValue<T>(context.BindingParameters, name, defaultValue);
|
||||
}
|
||||
|
||||
internal static T GetValue<T>(BindingParameterCollection bindingParameters, string name, T defaultValue)
|
||||
{
|
||||
if (bindingParameters == null ||
|
||||
bindingParameters.Count == 0)
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
IDictionary<string, object> endpointSettings = bindingParameters.Find<IDictionary<string, object>>();
|
||||
|
||||
object setting;
|
||||
|
||||
if (endpointSettings == null ||
|
||||
!endpointSettings.TryGetValue(name, out setting) ||
|
||||
!(setting is T))
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return (T)setting;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user