#define

This is a discussion on #define within the C# Programming forums, part of the General Programming Boards category; i have looked in .NET's help and searched on this forum before i ask. q) is it possible to use ...

  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
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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, 11: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, 12:49 PM
  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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21