public ParameterContext CloneFrom(ParameterContext previousContext) { if (previousContext == null) { throw new ArgumentNullException(nameof(previousContext)); } var name = previousContext.Name; if (parameterContexts.TryGetValue(name, out ParameterContext existingValue)) { if (existingValue.Equals(previousContext)) { return(existingValue); } throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Resources.ParameterAlreadyAdvertised, name)); } ParameterContext newContext = previousContext.DeepClone(); _ = parameterContexts.TryAdd(name, newContext); return(newContext); }