TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
moe sat
NA
21
10.4k
In Looping cann't remove and insert ArrayList?
Nov 18 2013 8:46 PM
I am a C# beginner.I've some problem with this exercise.Can you give me some advise?Because I've no ide what should i do.
ArrayList arrayList = new ArrayList();
Console.Write("Enter code:");
arrayList.Add(Console.ReadLine());
Console.Write("Enter qty:");
arrayList.Add(Convert.ToInt32(Console.ReadLine()));
Console.Write("Enter code:");
arrayList.Add(Console.ReadLine());
Console.Write("Enter qty:");
arrayList.Add(Convert.ToInt32(Console.ReadLine()));
ArrayList looplist = new ArrayList(arrayList);
foreach (object text in looplist)
{
if (Convert.ToString(text) == "p")
{
arrayList.RemoveAt(0);
arrayList.Insert(0, "Programming");
}
else
{
arrayList.RemoveAt(2);
arrayList.Insert(2, "Graphic");
}
Console.WriteLine("{0}", text);
}
Reply
Answers (
3
)
calculate tax, taking money as input in c#
Realtime logging using C#