Thread: #define

  1. #1
    budding software engineer luigi40's Avatar
    Join Date
    Jun 2004
    Location
    South Coast UK
    Posts
    61

    Question #define

    i have looked in .NET's help and searched on this forum before i ask.

    q) is it possible to use the preproccesor #define used in C & C++ in C#

    ie #define MOVE 0

    if not how do i implement that construct in C# please

    luigi

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    You didn't search very well. This was my very first search result: http://msdn.microsoft.com/library/de...clrfdefine.asp

    With higher-level, more object-oriented languages like C++ and C#, it's better to use const's anyway.

  3. #3
    budding software engineer luigi40's Avatar
    Join Date
    Jun 2004
    Location
    South Coast UK
    Posts
    61

    thanks

    hi sean

    thanks for your reply, i found that page on MSDN all ready which describes how in C# you use define with only one symbol

    however my question was how do i implement the #define symbol symbol

    not C# way of #define symbol

    as you mention constants i guess thats the answer

    luigi

  4. #4
    Banned nickname_changed's Avatar
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    986
    C++'s #define is used a lot for macros. In a well designed OOP approach, you don't need macros, and they can really confuse things. So the C# designers decided to leave it out.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pointer within a Struct
    By Bladactania in forum C Programming
    Replies: 11
    Last Post: 04-03-2009, 10:20 PM
  2. Why?!?
    By p3rry in forum C Programming
    Replies: 3
    Last Post: 01-08-2009, 12:52 PM
  3. size of an integer pointer
    By onebrother in forum C Programming
    Replies: 5
    Last Post: 07-09-2008, 11:49 AM
  4. Please STICKY this- vital to MSVC 6 dev - BASETSD.h
    By VirtualAce in forum Game Programming
    Replies: 11
    Last Post: 03-15-2005, 09:22 AM
  5. float toolbar!
    By c-- in forum Windows Programming
    Replies: 5
    Last Post: 02-04-2003, 09:44 AM