Archived

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

Converting C++ statements to C#

This topic is 5673 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
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