Add places an element at the end of a List.
Above statement is given in the following website. What is meant by "end of a List"? Problem is highlighted.
http://www.dotnetperls.com/list-add
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Sep 10, 2013, 7:12 AM EDT
As well as adding elements to a List
Posted Sep 10, 2013, 7:22 AM EDT
Posted Sep 10, 2013, 12:52 PM EDT
a = 1 b = 2
a = 3 b = 4
a = 5 b = 6
using System;
using System.Collections.Generic;
class Program
{
static void Main()
{
// Add three objects to a List.
List
list.Add(new Test(1, 2));
list.Add(new Test(3, 4));
list.Add(new Test(5, 6));
Console.WriteLine("a = {0} b = {1}", list.getNumberA(), list.getNumberB());
}
class Test
{
int a;
int b;
public Test(int a, int b)
{
this.a = a;
this.b = b;
}
public int getNumberA()
{
return a;
}
public int getNumberB()
{
return b;
}
}
}
VulpesRank #55 · 29.2K reputationPosted Sep 10, 2013, 2:01 PM EDT
Posted Sep 10, 2013, 2:21 PM EDT