Answer Posted / mithun
By using a generic class, we can create classes that is type safe at compile time.
ArrayList is a highly convenient collection class that can be used without modification to store any reference or value type. Any reference or value type that is added to an ArrayList is implicitly upcast to Object. If the items are value types, they must be boxed when they are added to the list, and unboxed when they are retrieved. Both the casting and the boxing and unboxing operations decrease performance
ArrayList list = new ArrayList();
list.Add(3);
list.Add("It is raining in Redmond.");
int t = 0;
foreach (int x in list)
{
t += x;
}
This will cause a programming error, and this error will not be detected until runtime.
In the generic List<T> collection, the same operation of adding items to the collection
List<int> list1 = new List<int>();
list1.Add(3);
list1.Add("It is raining in Redmond."); // this gives Compile-time error.
Now you can create a list that is not only safer than ArrayList, but also significantly faster, especially when the list items are value types.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Is asp.net outdated?
What methods are fired during the page load? Init()
Why mvc is faster than asp.net? : Asp.Net MVC
How can you display all validation messages in one control?
What are the different method of navigation in asp.net?
Can you explain autopostback?
What is difference between Fragment Caching and Page Caching in ASP.NET?
Describe how to implement globalization and localization in the use interface in .net.
What is advantage of code behind coding in ASP.NET?
What is Model-View-View Model?
What events will occur when a page is loaded?
Hi this is the coding for adding data in to an xml table
i want the coding for update and delete
Try
Dim emp_xml_doc As New XmlDocument
If
System.IO.File.Exists(Server.MapPath("emp.xml")) Then
emp_xml_doc.Load(Server.MapPath("emp.xml"))
Dim myrow_element As XmlElement
myrow_element =
emp_xml_doc.CreateElement("EmpDetails")
Dim str As String
str = "
What is server side session management?
Explain difference betn dataset and recordset?
Briefly describe the role of global.asax?