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

GetItems() public method

Gets the items in the collection as a T:object[].
public GetItems ( object editValue ) : object[]
editValue object The collection object being edited.
return object[]
        public virtual object[] GetItems(object editValue)
        {
            ICollection collection = editValue as ICollection;
            Array array = editValue as Array;

            if (collection != null)
            {
                ArrayList list = new ArrayList();
                foreach (var o in collection)
                    list.Add(o);
                return list.ToArray();
            }
            else if (array != null)
            {
                object[] newArray = new object[array.Length];
                array.CopyTo(newArray, 0);
                return newArray;
            }

            return new object[0];
        }

Usage Example

Exemplo n.º 1
0
 private void ObjectCollectionEditorForm_Load(object sender, EventArgs e)
 {
     foreach (object obj in editor.GetItems(value))
     {
         textBox1.AppendText(obj.ToString() + '\n');
     }
     lines = textBox1.Lines.Length;
 }