Skip to content

Commit

Permalink
Minor.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanwin committed May 17, 2010
1 parent e8a3f99 commit df4c8d2
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions source/MongoDB/MongoConnectionStringBuilder.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

Expand Down Expand Up @@ -292,11 +293,12 @@ public class MongoConnectionStringBuilder
/// Parses the servers.
/// </summary>
/// <param name="value">The value.</param>
private void ParseServers(string value){
var servers = value.Split (',');

foreach (var server in servers) {
var serverMatch = ServerRegex.Match (server);
private void ParseServers(string value)
{
var servers = value.Split (',');

foreach(var serverMatch in servers.Select(server => ServerRegex.Match(server)))
{
if (!serverMatch.Success)
throw new FormatException (string.Format ("Invalid server in connection string: {0}", serverMatch.Value));

Expand All @@ -306,7 +308,7 @@ public class MongoConnectionStringBuilder
if (int.TryParse (serverMatch.Groups[2].Value, out port))
AddServer (serverHost, port);
else
AddServer (serverHost);
AddServer (serverHost);
}
}

Expand Down

0 comments on commit df4c8d2

Please sign in to comment.