Using Generics in C#
page 1 of 7
Published: 03 Jan 2007
Abstract
Generics allow us to create type safe collections with no boxing and un-boxing overhead. It is a concept that allows us to achieve parametric polymorphism. This article discusses this concept with examples.
by Joydip Kanjilal
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 99428/ 166

Introduction

C# is a strongly typed language, i.e., objects in C# should have a type prior to holding any value. This enforces language interoperability and security but restricts the programmer to specify the type of an object at the time of writing the program as the type of an object in C# cannot be determined at runtime. Generics are a new concept that has been introduced with C# 2.0 and it helps us to defer the binding of a generic type to a data type until its point of usage arrives. It is one of the most powerful and anticipated feature of the C# 2.0 language. The basic idea behind generics is to develop universal classes and methods that can accept a type as a parameter to promote reusability, efficiency and maintainability of code. This article discusses Generics, its usage, merits and demerits with code examples wherever necessary.


View Entire Article

User Comments

No comments posted yet.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2017 ASPAlliance.com  |  Page Processed at 2017-03-23 4:18:58 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search