Solved

How can i create and use Generic in C# 4.0?

Posted on 2011-03-25
3
264 Views
Last Modified: 2013-12-17
I need a manual or tutorial with examples of how to  use Generic and when to use them.

I am studying Thread right now and I need to know how Generics come into place.

Also, I need to have a clear picture of when to use them and when not.

Thank you for your help.
0
Comment
Question by:iscivanomar
3 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 250 total points
ID: 35213969
Generics and threads are two different things, don't confuse them.

A thread will allow you to for example perform a long calculation AND have the main window still respond to the user.

A generic will allow you to have one function that can work with many different types of objects.
0
 
LVL 27

Assisted Solution

by:nmarun
nmarun earned 250 total points
ID: 35214625
As Andy said, they are two different things.

I'm sure you're reading your previous question about threads:
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_26909278.html

Just keep that on a different 'compartment' and then read this about Generics:
http://msdn.microsoft.com/en-us/library/ms379564%28v=vs.80%29.aspx

Arun
0
 

Author Closing Comment

by:iscivanomar
ID: 35215117
Thank you AndyAinscow for you short but precise answer.

Yes in deed, I read the other question and created some little programs to get the idea and get use to write threads. also, thank you for the manual an Generic.

Have a good day both.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

776 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