Solved

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

Posted on 2012-04-08
1
258 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

861 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