/// <inheriteddoc /> protected override void OnGetCategoryNames(ICollection <IEnumerable <char> > names) { IEnumerable <string> catNames = this._INNER_CONF .GetCategoryNames() ?? CollectionHelper.Empty <string>(); CollectionHelper.AddRange(names, CollectionHelper.Cast <IEnumerable <char> >(catNames)); }
public void AddRange() { var list = new List <int>(); CollectionHelper.AddRange(list, new[] { 1, 2, 3 }); Assert.AreEqual(3, list.Count); Assert.AreEqual(1, list[0]); Assert.AreEqual(2, list[1]); Assert.AreEqual(3, list[2]); }
// Public Methods (3) /// <summary> /// /// </summary> /// <see cref="ITemplate.GetAllVars()" /> public virtual IDictionary <string, object> GetAllVars() { IDictionary <string, object> result; lock (this._SYNC) { result = new Dictionary <string, object>(); CollectionHelper.AddRange(result, this._VARS); } return(result); }
private static void CollectProperties(ICollection <PropertyInfo> properties, Type type, ICollection <Type> handledTypes) { if (handledTypes.Contains(type)) { return; } CollectionHelper.AddRange(properties, type.GetProperties()); CollectionHelper.ForEach(type.GetInterfaces(), delegate(IForEachItemExecutionContext <Type> ctx) { CollectProperties(properties, ctx.Item, handledTypes); }); }
/// <summary> /// Converts the items of a sequence of objects to a sequence of console arguments. /// </summary> /// <param name="args">The input arguments.</param> /// <returns>The parsed argument list.</returns> protected virtual IEnumerable ToConsoleArguments(IEnumerable args) { if (args == null) { return(new object[] { null }); } List <object> result = new List <object>(); CollectionHelper.AddRange(result, CollectionHelper.Select(CollectionHelper.Cast <object>(args), delegate(object a) { return((object)StringHelper.AsString(this.ToConsoleString(a))); })); return(result.ToArray()); }
public void AddRangeShouldThrowArgumentNullException2() { CollectionHelper.AddRange(new List <int>(), null); }
public void AddRangeShouldThrowArgumentNullException1() { CollectionHelper.AddRange(null, new [] { 1, 2, 3 }); }
/// <summary> /// Sets up that form or its controls for handling form move by dragging it or its controls. /// </summary> /// <param name="controlsThatHandleFormMove">The list that defines what controls should handle the form move.</param> protected virtual void SetupMoveableForm(IList <Control> controlsThatHandleFormMove) { CollectionHelper.AddRange(controlsThatHandleFormMove, CollectionHelper.OfType <Control>(this.Controls)); }
// Public Methods (1) /// <summary> /// /// </summary> /// <see cref="CollectionHelper.AddRange{T}(ICollection{T}, IEnumerable{T})" /> public static void AddRange <T>(this ICollection <T> coll, IEnumerable <T> seq) { CollectionHelper.AddRange <T>(coll, seq); }