Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Pav

Converting C++ statements to C#

This topic is 5885 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 to all of you it''s like this... in C++ u can use statements like typedef and #define. well, what i need to know is what is their counterpart in C#.. how do i typedef something in C#? or how do i do #define x 15 in C#.. thanx!.

Share this post


Link to post
Share on other sites
Advertisement
For typedefs, use the "using" keyword. It allows you alias a class or a namespace name.

using Something = MyClass.Subclass;

There is no preprocessor in C#, you''ll have to use const variables in place of #defines. Not to start a Holy War but many will argue that you shouldn''t be using #defines that much in C++ either.

Share this post


Link to post
Share on other sites
ok, but what if i have something like

typedef unsigned int GLuint;

how do i transfer it to C#?

Share this post


Link to post
Share on other sites
The typedef statement is not very useful in C#, since a uint is clearly defined to be 32 bit, no matter what platform you are on.

Share this post


Link to post
Share on other sites

  • 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!