array of objects in C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gilit golit
    New Member
    • Feb 2011
    • 27

    array of objects in C#

    How do I declare array of objects (in C#) ?
  • NitinSawant
    Contributor
    • Oct 2007
    • 271

    #2
    you can create list of objects using following syntax
    Code:
    Object[] obj=new Object[10];
    //or
    List<object> lstObjects=new List<object>();
    Code:
    using System.Collections.Generic;

    Comment

    • gilit golit
      New Member
      • Feb 2011
      • 27

      #3
      Thanks.
      I wrote :
      System.Windows. Forms.Button [] buttons_list = new System.Windows. Forms.Button [10];
      (ok)
      and then, I wrote :
      buttons_list[1] = button7 ;
      and it complained:
      buttons_list is a filed , but is used like a type

      help !

      Comment

      Working...