Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2011-03-25
3
273 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

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

Suggested Solutions

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…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!

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