Solved

How can we make Generics strongly typed - C# / VB.NET

Posted on 2012-04-08
1
256 Views
Last Modified: 2012-04-09
Hi,

Can you please let me know:

How can we make Generics strongly typed - C# / VB.NET ?

Thanks
0
Comment
Question by:milani_lucie
1 Comment
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 500 total points
ID: 37822528
Generics by their very nature are strongly typed or Type Safe.
Type Safe means that the type supplied to a generic type will make the generic type work with that type only.

for example ArrayList is collection of objects and thus it cannot guarantee that it will contain only objects of one type(say FileStream), however A generic list List<T> will always work on collection of object of Type T where T Can be substituted with any .net type, List<FileStream> will always be a List of FileStream objects.

http://www.codeproject.com/Articles/19884/Generics-sample-in-C
http://msdn.microsoft.com/en-us/library/ms379564%28v=vs.80%29.aspx
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question