Jump to content
  • Advertisement
Sign in to follow this  
cptrnet

C# Generics

This topic is 4859 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Im trying to learn generics but when i do this public class Test<T> { } it gives me the red lines under the < and >

Share this post


Link to post
Share on other sites
Advertisement
Well I don't have much experience with C# but nothing appears to be wrong, what error are you actually getting and what other code is there?

Oh and are you using VS 2005?

Share this post


Link to post
Share on other sites
I am using 2003, it says the "{" is expected on "<" and "invalid token" for ">"

I just made a new class from scratch


public class Class1<T>
{
public Class1()
{

}
}

Share this post


Link to post
Share on other sites
This seems to be an excellent source of information on generics. Looking at your code I didn't see anything wrong.

BTW, IIRC generics aren't supported in Visual Studio 2003 -- only in the latest incarnation (2005). Not sure though.

Share this post


Link to post
Share on other sites
I think you can have support for Generics in 2003 if you rebuild your CLI if I recall correctly.

A quick google search on rotor and generics gave me this link

Hope this helps

Eric

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!