Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
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
 
Old June 26th, 2007, 12:54 PM
Authorized User
 
Join Date: Dec 2005
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
 
Old June 27th, 2007, 05:40 PM
Wrox Author
 
Join Date: Oct 2005
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
================================================== =========
 
Old June 28th, 2007, 06:48 AM
Registered User
 
Join Date: Jun 2007
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.
 
Old June 28th, 2007, 07:00 AM
Registered User
 
Join Date: Jun 2007
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.
 
Old June 28th, 2007, 05:39 PM
Wrox Author
 
Join Date: Oct 2005
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
================================================== =========
 
Old June 29th, 2007, 01:49 AM
Registered User
 
Join Date: Jun 2007
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.
 
Old November 6th, 2007, 08:05 AM
Authorized User
 
Join Date: Dec 2005
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
 
Old November 8th, 2007, 04:55 AM
Authorized User
 
Join Date: Sep 2007
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.

 
Old November 8th, 2007, 05:14 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
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 -/





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





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