Results 1 to 3 of 3

Thread: equals

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    equals

    Hi,

    In an old version of c i had to use something like this: if (x==y). I am wondering if I can now use if (x=y) or do I still need the ==?

    Jeremy

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Nope, == is an overloaded operator that implicity performs either a reference equality or value equality comparison, dependent upon the type being used.

  3. #3
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Also since C# is strongly type, if (x=y) this would never compile, because you are performing and assignment and it would always be true. In C or C++ this would be hard to catch, leading to some frustrating debugging sessions.
    Dont gain the world and lose your soul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width