Skip to content

Commit 00ac512

Browse files
Turn ConnectionFactory#AuthMechanisms to an IList
1 parent e600fdf commit 00ac512

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
using System;
4545
using System.Collections.Generic;
4646
using System.Threading.Tasks;
47+
using System.Linq;
4748

4849
#if !NETFX_CORE
4950

@@ -143,12 +144,13 @@ public class ConnectionFactory : ConnectionFactoryBase, IConnectionFactory
143144
/// <summary>
144145
/// Default SASL auth mechanisms to use.
145146
/// </summary>
146-
public static readonly AuthMechanismFactory[] DefaultAuthMechanisms = { new PlainMechanismFactory() };
147+
public static readonly IList<AuthMechanismFactory> DefaultAuthMechanisms =
148+
new List<AuthMechanismFactory>(){ new PlainMechanismFactory() };
147149

148150
/// <summary>
149151
/// SASL auth mechanisms to use.
150152
/// </summary>
151-
public AuthMechanismFactory[] AuthMechanisms = DefaultAuthMechanisms;
153+
public IList<AuthMechanismFactory> AuthMechanisms = DefaultAuthMechanisms;
152154

153155
/// <summary>
154156
/// Set to true to enable automatic connection recovery.
@@ -212,7 +214,7 @@ public ConnectionFactory()
212214
}
213215

214216
/// <summary>
215-
/// The AMQP connection target.
217+
/// Connection endpoint.
216218
/// </summary>
217219
public AmqpTcpEndpoint Endpoint
218220
{
@@ -285,12 +287,12 @@ public Uri uri
285287
/// Given a list of mechanism names supported by the server, select a preferred mechanism,
286288
/// or null if we have none in common.
287289
/// </summary>
288-
public AuthMechanismFactory AuthMechanismFactory(string[] mechanismNames)
290+
public AuthMechanismFactory AuthMechanismFactory(IList<string> mechanismNames)
289291
{
290292
// Our list is in order of preference, the server one is not.
291293
foreach (AuthMechanismFactory factory in AuthMechanisms)
292294
{
293-
if (Array.Exists(mechanismNames, x => string.Equals(x, factory.Name, StringComparison.OrdinalIgnoreCase)))
295+
if (mechanismNames.Any<string>(x => string.Equals(x, factory.Name, StringComparison.OrdinalIgnoreCase)))
294296
{
295297
return factory;
296298
}

projects/client/RabbitMQ.Client/src/client/api/IConnectionFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public interface IConnectionFactory
9090
/// Given a list of mechanism names supported by the server, select a preferred mechanism,
9191
/// or null if we have none in common.
9292
/// </summary>
93-
AuthMechanismFactory AuthMechanismFactory(string[] mechanismNames);
93+
AuthMechanismFactory AuthMechanismFactory(IList<string> mechanismNames);
9494

9595
/// <summary>
9696
/// Create a connection to the specified endpoint.

0 commit comments

Comments
 (0)