internal void EnableGranularValidation(ValidateStringCallback validationCallback) { // Iterate over all the keys, adding each to the set containing the keys awaiting validation. // Unlike dictionaries, HashSet<T> can contain null keys, so don't need to special-case them. _keysAwaitingValidation = new HashSet <string>(Keys.Cast <string>(), StringComparer.OrdinalIgnoreCase); _validationCallback = validationCallback; }
/// <summary> /// Clears the contents of the <see cref="NpgsqlConnectionStringBuilder"/> instance. /// </summary> public override void Clear() { Contract.Assert(Keys != null); foreach (var k in Keys.Cast <string>().ToArray()) { Remove(k); } }
/* * We added granular request validation in ASP.NET 4.5 to provide a better request validation story for our developers. * Instead of validating the entire collection ahead of time, we'll only validate entries that are actually looked at. */ internal void EnableGranularValidation(ValidateStringCallback validationCallback) { // Iterate over all the keys, adding each to the set containing the keys awaiting validation. // Unlike dictionaries, HashSet<T> can contain null keys, so don't need to special-case them. _keysAwaitingValidation = new HashSet <string>(Keys.Cast <string>().Where(KeyIsCandidateForValidation), StringComparer.OrdinalIgnoreCase); _validationCallback = validationCallback; // This forces CopyTo and other methods that cache entries to flush their caches, ensuring // that all values go through validation again. InvalidateCachedArrays(); }
public void Set(string key, string value) { EnsureExistence(); if (Has(key)) { var index = Keys.Cast <string>().IndexOf(key); Values[index] = value; } else { Keys.Add(key); Values.Add(value); } }
public bool Has(string key) { EnsureExistence(); return(Keys.Cast <string>().Contains(key)); }
public string Get(string key) { EnsureExistence(); return(Keys.Cast <string>().Corresponding(key, Values.Cast <string>())); }
/// <summary> /// Returns a string containing all the settings in the class, in querystring form. Use ToStringEncoded() to get a URL-safe querystring. /// This method does not encode commas, spaces, etc. /// </summary> /// <returns></returns> public override string ToString() { return(string.Join(";", Keys.Cast <string>().Select(x => x + ":" + this[x]))); }
public override string ToString() { return(string.Join("&", Keys.Cast <string>().Select( key => string.Format("{0}={1}", key, this[key])))); }
public static async Task<bool> SendKeyCombination(Keys[] keys, int time) { return await SendKeyCombination(keys.Cast<VirtualKeys>().ToArray(), time); }
public IEnumerable <IKey> GetKeys() => Keys.Cast <IKey>();
/// <summary> /// Stimulate a key combination press /// </summary> /// <param name="keys">The key combination</param> /// <returns>If the function succeeds it returns true; otherwise, returns false</returns> public static bool SendKeyCombination(Keys[] keys) { return SendKeyCombination(keys.Cast<VirtualKeys>().ToArray()); }
public ConnectionConfiguration Parse(string connectionString) { ConnectionString = connectionString; var connectionConfiguration = new ConnectionConfiguration(settings); var connectionConfigurationType = typeof(ConnectionConfiguration); foreach (var key in Keys.Cast <string>()) { var property = connectionConfigurationType.GetProperty(key, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance); property?.SetValue(connectionConfiguration, TypeDescriptor.GetConverter(property.PropertyType).ConvertFrom(this[key])); } if (connectionConfiguration.UseTls && !ContainsKey("port")) { connectionConfiguration.Port = 5671; } if (ContainsKey("host")) { ParseHosts(connectionConfiguration, this["host"] as string); } else { throw new Exception("Invalid connection string. 'host' value must be supplied. e.g: \"host=myServer\""); } if (ContainsKey("dequeuetimeout")) { var message = "The 'DequeueTimeout' connection string option has been removed. Consult the documentation for further information."; Logger.Error(message); throw new NotSupportedException(message); } if (ContainsKey("maxwaittimeforconfirms")) { var message = "The 'MaxWaitTimeForConfirms' connection string option has been removed. Consult the documentation for further information"; Logger.Error(message); throw new NotSupportedException(message); } if (ContainsKey("prefetchcount")) { var message = "The 'PrefetchCount' connection string option has been removed. Use 'EndpointConfiguration.UseTransport<RabbitMQTransport>().PrefetchCount' instead."; Logger.Error(message); throw new NotSupportedException(message); } if (ContainsKey("usepublisherconfirms")) { var message = "The 'UsePublisherConfirms' connection string option has been removed. Use 'EndpointConfiguration.UseTransport<RabbitMQTransport>().UsePublisherConfirms' instead."; Logger.Error(message); throw new NotSupportedException(message); } return(connectionConfiguration); }
/// <summary> /// /// </summary> /// <returns></returns> public Task CleatAsync() { return(_db.HashDeleteAsync(Name, Keys.Cast(x => (RedisValue)x).ToArray())); }
/// <summary> /// /// </summary> public void Clear() { _db.HashDelete(Name, Keys.Cast(x => (RedisValue)x).ToArray()); }
public override System.Collections.Generic.IEnumerable <string> GetDynamicMemberNames() { return(Keys.Cast <string>().AsEnumerable()); }