|  | @@ -30,6 +30,7 @@
 | 
	
		
			
				|  |  |  #endregion
 | 
	
		
			
				|  |  |  using System;
 | 
	
		
			
				|  |  |  using System.Collections.Generic;
 | 
	
		
			
				|  |  | +using System.Collections.Immutable;
 | 
	
		
			
				|  |  |  using System.Runtime.InteropServices;
 | 
	
		
			
				|  |  |  using System.Threading;
 | 
	
		
			
				|  |  |  using System.Threading.Tasks;
 | 
	
	
		
			
				|  | @@ -37,33 +38,18 @@ using Grpc.Core.Internal;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  namespace Grpc.Core
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  | -    // TODO: should we be using the builder pattern?
 | 
	
		
			
				|  |  | +    /// <summary>
 | 
	
		
			
				|  |  | +    /// gRPC channel options.
 | 
	
		
			
				|  |  | +    /// </summary>
 | 
	
		
			
				|  |  |      public class ChannelArgs
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          public const string SslTargetNameOverrideKey = "grpc.ssl_target_name_override";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        public class Builder
 | 
	
		
			
				|  |  | -        {
 | 
	
		
			
				|  |  | -            Dictionary<string, string> stringArgs = new Dictionary<string, string>();
 | 
	
		
			
				|  |  | -            // TODO: AddInteger not supported yet.
 | 
	
		
			
				|  |  | -            public Builder AddString(string key, string value)
 | 
	
		
			
				|  |  | -            {
 | 
	
		
			
				|  |  | -                stringArgs.Add(key, value);
 | 
	
		
			
				|  |  | -                return this;
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | +        readonly ImmutableDictionary<string, string> stringArgs;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -            public ChannelArgs Build()
 | 
	
		
			
				|  |  | -            {
 | 
	
		
			
				|  |  | -                return new ChannelArgs(stringArgs);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        Dictionary<string, string> stringArgs;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -        private ChannelArgs(Dictionary<string, string> stringArgs)
 | 
	
		
			
				|  |  | +        private ChannelArgs(ImmutableDictionary<string, string> stringArgs)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            // TODO: use immutable dict?
 | 
	
		
			
				|  |  | -            this.stringArgs = new Dictionary<string, string>(stringArgs);
 | 
	
		
			
				|  |  | +            this.stringArgs = stringArgs;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public string GetSslTargetNameOverride()
 | 
	
	
		
			
				|  | @@ -76,11 +62,28 @@ namespace Grpc.Core
 | 
	
		
			
				|  |  |              return null;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        public static Builder NewBuilder()
 | 
	
		
			
				|  |  | +        public static Builder CreateBuilder()
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  |              return new Builder();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +        public class Builder
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            readonly Dictionary<string, string> stringArgs = new Dictionary<string, string>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            // TODO: AddInteger not supported yet.
 | 
	
		
			
				|  |  | +            public Builder AddString(string key, string value)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                stringArgs.Add(key, value);
 | 
	
		
			
				|  |  | +                return this;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            public ChannelArgs Build()
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                return new ChannelArgs(stringArgs.ToImmutableDictionary());
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          /// <summary>
 | 
	
		
			
				|  |  |          /// Creates native object for the channel arguments.
 | 
	
		
			
				|  |  |          /// </summary>
 |