Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now