new object new arraylist

ijas1981ijas1981 Member Posts: 19 ■□□□□□□□□□
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
object o = "testObject";

ArrayList myArrayList_1 = new ArrayList();
myArrayList_1.Add("abc");
myArrayList_1.Add(123);
myArrayList_1.Add(o);

string[] myStringArray_1 = new string[] { "hello ", "secure ", "world " };
myArrayList_1.AddRange(myStringArray_1);

object[] myObjectArray_1= new object[]{new object() , new ArrayList()}; // LINE OF CODE 01

myArrayList_1.AddRange(myObjectArray_1); // LINE OF CODE 02


}
}
}


// CAN YOU EXPLAIN ME THE THE
// LINE OF CODE 01
//AND
// LINE OF CODE 02
//
//

icon_sad.gificon_sad.gif

Comments

  • DeepCodeDeepCode Member Posts: 29 ■□□□□□□□□□
    object[] myObjectArray_1= new object[]{new object() , new ArrayList()}; // LINE OF CODE 01
    

    That line creates an instance of an object array and populates it with an object instance, and an arrayList instance
     myArrayList_1.AddRange(myObjectArray_1); // LINE OF CODE 02
    

    Adds the elements of myObjectArray to the myArrayList_1 ArrayList.[/code]
Sign In or Register to comment.