/// <summary> /// Adds a series of <see cref="INamedInclusionScopeCoercion"/> elements /// to the <see cref="ScopeCoercionCollection"/> with the <paramref name="names"/> /// provided. /// </summary> /// <param name="names">The series of <see cref="String"/> values which /// represent the names to include within the scope to aid in identity /// resolution.</param> /// <returns>A <see cref="INamedInclusionScopeCoercion"/>.</returns> public INamedInclusionScopeCoercion[] AddNames(params string[] names) { if (names == null) { throw new ArgumentNullException("names"); } names = (from name in names orderby name orderby name.Length < 6 ? 2 : name.Substring(0, 6) == "System" ? 0 : name.Length < 9 ? 2 : name.Substring(0, 9) == "Microsoft" ? 1 : 2 select name).ToArray(); INamedInclusionScopeCoercion[] result = new INamedInclusionScopeCoercion[names.Length]; for (int i = 0; i < names.Length; i++) { if (names[i] == null) { throw new ArgumentNullException("names"); } var currentElement = new NamedInclusionScopeCoercion() { IncludedName = names[i] }; result[i] = currentElement; lock (this.baseList) this.baseList.Add(currentElement); } return(result); }
/// <summary> /// Adds a <see cref="INamedInclusionScopeCoercion"/> which details the name /// of a namespace or a type whose identity needs resolved prior to further /// identity resolution. /// </summary> /// <param name="name">The <see cref="String"/> value representing the /// name to merge into the active scope during identity resolution.</param> /// <returns>A <see cref="INamedInclusionScopeCoercion"/> which denotes /// the details of the scope coercion.</returns> public INamedInclusionScopeCoercion AddName(string name) { var result = new NamedInclusionScopeCoercion() { IncludedName = name }; lock (this.baseList) this.baseList.Add(result); return(result); }