Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 26th, 2007, 12:54 PM
Authorized User
 
Join Date: Dec 2005
Location: Lucknow, UP, India.
Posts: 28
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to surendraparashar
Default === operator in c#

Plese tell me about === operator in c#

Surendra
__________________
Surendra Parashar
Gurgaon,
http://www.geocities.com/surendraparashar
  #2 (permalink)  
Old June 27th, 2007, 05:40 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Do you mean the

== operator? That is an equality operator which determines if the value on the left is equal to the value on the right.

I have never seen === as on operator and it doesn't exist on the MSDN page either: http://msdn2.microsoft.com/en-us/library/6a71f45d(VS.80).aspx

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
  #3 (permalink)  
Old June 28th, 2007, 06:48 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Enslave
Default

=== does exist in i.e php if I'm not mistaken..

dont remember what it does tho =/

Enuff enuff!

C# btw.
  #4 (permalink)  
Old June 28th, 2007, 07:00 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Enslave
Default

$a === $b
Identical TRUE if $a is equal to $b, and they are of the same type.
(introduced in PHP 4)


so there :]

-----------
Enuff enuff!

C# btw.
  #5 (permalink)  
Old June 28th, 2007, 05:39 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

So what is it in C# then, do you have a reference to the MSDN perhaps?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
  #6 (permalink)  
Old June 29th, 2007, 01:49 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Enslave
Default

I doubt it exists in C# tbh..

http://msdn2.microsoft.com/en-us/library/6a71f45d(vs.71).aspx


didnt find it there atleast

-----------
Enuff enuff!

C# btw.
  #7 (permalink)  
Old November 6th, 2007, 08:05 AM
Authorized User
 
Join Date: Dec 2005
Location: Lucknow, UP, India.
Posts: 28
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to surendraparashar
Default

Hi,

Okay Fine

Surendra Parashar
Gurgaon, Hariyana
http://www.geocities.com/surendraparashar
  #8 (permalink)  
Old November 8th, 2007, 04:55 AM
Authorized User
 
Join Date: Sep 2007
Location: , , Finland.
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, it is there. See is-operator here

http://msdn2.microsoft.com/en-us/library/scekt9xw.aspx

So what you need to do is something like this:

Code:
object obj1 = 1;
object obj2 = "1";

if (obj1 is obj2 and obj1 == obj2)
{
    // same as obj1 === obj2
}
else
{
    // same as obj1 !== obj2
}
In PHP (and VB without strict option) that would evaluate always as true because of it's sick type casting behaviour.

  #9 (permalink)  
Old November 8th, 2007, 05:14 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Another option might be the Object.ReferenceEquals method, depending on what you are trying to achieve.

if( Object.ReferenceEquals(obj1, obj2) )
{
  // true if obj1 and obj2 are references to the same object.
}



/- Sam Judson : Wrox Technical Editor -/
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use like operator thillaiarasu SQL Server 2000 4 April 23rd, 2010 09:47 AM
having problem with Between operator anantdev SQL Language 1 May 26th, 2008 08:14 AM
Invalid operator for data type. Operator equals di Pusstiu SQL Server 2000 2 August 10th, 2007 04:51 AM
intersect operator kapy_kal XSLT 1 March 29th, 2006 02:02 PM
Use of return operator. PC BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 3 July 1st, 2005 09:54 AM



All times are GMT -4. The time now is 02:19 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.