What are generics? why it is used?
architecture of ASP.NET?

Answers were Sorted based on User's Feedback



What are generics? why it is used? architecture of ASP.NET? ..

Answer / pavithra d

Generics are new in .NET 2.0.It is used to define a type
while leaving some details unspecified.Generics are the
replacement of "Objects" in .NET1.1
Generics reduces the run-time error and increases the
performance.

Is This Answer Correct ?    15 Yes 4 No

What are generics? why it is used? architecture of ASP.NET? ..

Answer / krishna rathi

Generica provide type parameters T for class , interfaces,
delagates or methods.
By using generic type parameter T their
is less need of boxing / un boxing in client code.

Example : public class Genericlist <T>{
}

Is This Answer Correct ?    10 Yes 3 No

What are generics? why it is used? architecture of ASP.NET? ..

Answer / jyoti

Generics provide the solution to a limitation in earlier
versions of the common language runtime and the C# language
in which generalization is accomplished by casting types to
and from the universal base type Object. By creating a
generic class, you can create a collection that is type-
safe at compile-time.increases the
performance.

Is This Answer Correct ?    6 Yes 3 No

What are generics? why it is used? architecture of ASP.NET? ..

Answer / jithu

Generics are an extremely useful feature that allows you to
write type safe and efficient collection- and pattern-based
code.

Generics allow you to create type-safe code without knowing
the final type you will be working with. In many instances,
you want the types to have certain characteristics, in
which case you place constraints on the type

Is This Answer Correct ?    4 Yes 2 No

What are generics? why it is used? architecture of ASP.NET? ..

Answer / tak

Generics is a new feature added and shiped with .NET 2.0
and above that solves the type safe related issues. So
using generics reduces the extra work/time between boxing
and unboxing as a result boost performance.Using
Generics ,we will be safe a run time error which will
occure due to type casting problem that we may not see at
compile time...regardless of knowing the type at design
time..

Is This Answer Correct ?    2 Yes 0 No

What are generics? why it is used? architecture of ASP.NET? ..

Answer / me

Generics are the type safe data structures that was introduced in .Net 2.0.Following are the benefits of it-

Better Performance: They are better in performance as boxing/unboxing is not required.thus reducing execution cost and time.

Type safety : it gives error at compile time if a data type mismatch is found.

Code reusablity : Same code is reused for various data tyoe like int,string etc.

Is This Answer Correct ?    2 Yes 1 No

What are generics? why it is used? architecture of ASP.NET? ..

Answer / sachin

Generic is special kind of data type.
which can be resolve at a runtime.

means u can have function add(<T>val,<T>val)
where u can pass any type datatype.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More ASP.NET Interview Questions

What are session objects?

0 Answers  


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 = "<EmpID>" & TxtEmpId.Text & "</EmpID>" & _ "<Empname>" & TxtName.Text & "</Empname>" & _ "<EmpSalary>" & TxtSalary.Text & "</EmpSalary>" myrow_element.InnerXml = str emp_xml_doc.DocumentElement.AppendChild(myrow_element) emp_xml_doc.Save(Server.MapPath("emp.xml")) Response.Write("Record Saved") Dim ds As New DataSet ds.ReadXml(Server.MapPath("emp.xml")) GridView1.DataSource = ds GridView1.DataBind() Else Response.Write("File does not exist.") End If Catch ex As Exception Response.Write(ex.ToString) End Try *********************** this is the xml file <?xml version="1.0" encoding="utf-8" ?> <Employee> <empdetails> <empid>100</empid> <empname>xxx</empname> <empsalary>2000</empsalary> </empdetails> <EmpDetails> <EmpID>yyy</EmpID> <Empname>dddd</Empname> <EmpSalary>77777</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>rrrr</EmpID> <Empname>rrrr</Empname> <EmpSalary>6666</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>qaqa</EmpID> <Empname>sini</Empname> <EmpSalary>50000</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>errrrrrrrr</EmpID> <Empname>rrrrrrrrr</Empname> <EmpSalary>677777</EmpSalary> </EmpDetails> <EmpDetails> <EmpID>rrr</EmpID> <Empname>rrr</Empname> <EmpSalary>33</EmpSalary> </EmpDetails> </Employee>

0 Answers   InfoCom,


How does the XmlSerializer work? What ACL permissions does a process using it require?

2 Answers  


what is diffgram ?

3 Answers  


Why do you use the app_code folder in asp.net?

0 Answers  






What is clickid?

0 Answers  


Explain different types of Caching techniques in ASP.NET?

0 Answers   Sans Pareil IT Services,


How will you load dynamic assembly? How will create assesblies at run time?

0 Answers  


What is session in asp.net?

0 Answers  


what are the ways to improve performance in .net application?

7 Answers   Mind Tree,


what are the oops concepts are used in your project?

1 Answers   AppShark, IBM, Kotak,


What does the "EnableViewState" property do? Why would I want it on or off?

3 Answers  


Categories