Skip to main content

Posts

Showing posts with the label generics

Quick intro to generics

Recently ive been teaching some new developers on the team about generics, its not a new concept i know, and when you know about them you cant quite figure how people sometimes just dont know about them, they are so helpfull. So tell me about them then! Generics came in at .net 2.0 and are used extensively through out the .net framework internally, if you do much .net dev work you will come across then at some point. What are generics Generics allow you to define a type (class or structure) while leaving some of the details unspecified. Quick Tip When you see the following in code you know you are looking at code that uses generics //C# List myArray = new List (); List my2ndArray = new List (); 'VB.Net Dim myArray As New List(Of integer)(); Dim my2ndArray As New List(Of myClass)(); The main benefits for using generics are: Type safety (you can only put ints in a collection of ints for example) Performance (boxing and unboxing of primitive types is eliminated) Clarity ...

Facebook

Facebook Recommendations

Followers


Web Designing In Karachi



Haroof.com


Politics blogs

My Zimbio

Email Subscribe

Enter your email address:

Watch online Live TV

Labels

Show more