本文整理汇总了C#中PropertyBag.AddValue方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyBag.AddValue方法的具体用法?C# PropertyBag.AddValue怎么用?C# PropertyBag.AddValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyBag
的用法示例。
在下文中一共展示了PropertyBag.AddValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateSslMeta
private static void PopulateSslMeta(PropertyBag properties, SslStream stm)
{
properties.AddValue("SslProtocol", stm.SslProtocol);
properties.AddValue("IsSigned", stm.IsSigned);
properties.AddValue("IsMutallyAuthenticated", stm.IsMutuallyAuthenticated);
properties.AddValue("IsEncrypted", stm.IsEncrypted);
properties.AddValue("CipherAlgorithm", stm.CipherAlgorithm);
properties.AddValue("CipherStrength", stm.CipherStrength);
properties.AddValue("HashAlgorithm", stm.HashAlgorithm);
properties.AddValue("HashStrength", stm.HashStrength);
if(stm.LocalCertificate != null)
{
properties.AddValue("LocalCertificate", stm.LocalCertificate);
}
if (stm.RemoteCertificate != null)
{
properties.AddValue("RemoteCertificate", stm.RemoteCertificate);
properties.AddValue("KeyExchangeAlgorithm", stm.KeyExchangeAlgorithm);
properties.AddValue("KeyExchangeStrength", stm.KeyExchangeStrength);
}
}
示例2: PopulateBag
public override void PopulateBag(PropertyBag properties)
{
base.PopulateBag(properties);
properties.AddValue("Url", Url);
properties.AddValue("Headers", Headers);
}
示例3: PopulateBagFromSocket
/// <summary>
/// Populate a property bag from a socket
/// </summary>
/// <param name="sock">The socket</param>
/// <param name="properties">The property bag</param>
public static void PopulateBagFromSocket(Socket sock, PropertyBag properties)
{
properties.AddValue("AddressFamily", sock.AddressFamily);
properties.AddValue("SocketType", sock.SocketType);
properties.AddValue("ProtocolType", sock.ProtocolType);
try
{
// This could throw a socket exception if not a connected socket (e.g. UDP)
AddEndpoint("RemoteEndpoint", sock.RemoteEndPoint, properties);
}
catch (SocketException)
{
}
AddEndpoint("LocalEndpoint", sock.LocalEndPoint, properties);
}
示例4: AddEndpoint
private static void AddEndpoint(string name, EndPoint ep, PropertyBag properties)
{
IPEndPoint ip = ep as IPEndPoint;
properties.AddValue(name, ep);
if(ip != null)
{
properties.AddValue(name + "Address", ip.Address);
properties.AddValue(name + "Port", ip.Port);
}
}
示例5: PopulateBag
/// <summary>
///
/// </summary>
/// <param name="properties"></param>
public override void PopulateBag(PropertyBag properties)
{
base.PopulateBag(properties);
if (Hostname != null)
{
properties.AddValue("Endpoint", new DnsEndPoint(Hostname, Port));
properties.AddValue("Hostname", Hostname);
}
else
{
properties.AddValue("Endpoint", new IPEndPoint(Address, Port));
properties.AddValue("Hostname", Address.ToString());
}
properties.AddValue("Protocol", ClientType == IpClientType.Tcp ? "TCP" : "UDP");
properties.AddValue("Port", Port);
properties.AddValue("Ipv6", Ipv6);
}