Accord.Controls.NumericCollectionEditor.SetItems C# (CSharp) Method

SetItems() public method

Sets the items in the collection.
public SetItems ( object editValue, object values ) : void
editValue object The collection object being edited.
values object The objects to be added in the collection.
return void
        public virtual void SetItems(object editValue, object[] values)
        {
            IList list = editValue as IList;
            Array array = editValue as Array;

            if (list != null)
            {
                list.Clear();
                foreach (var o in values)
                    list.Add(o);
            }
            else if (array != null)
            {
                Array.Copy(values, array, values.Length);
            }
        }
    }

Usage Example

コード例 #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            object[] values = new object[lines];
            for (int i = 0; i < textBox1.Lines.Length; i++)
            {
                string line = textBox1.Lines[i];
                values[i] = Convert.ChangeType(line, editor.CollectionItemType);
            }

            editor.SetItems(value, values);
        }