lordofduct, on 08 December 2010 - 02:49 PM, said:
Incorrect - Strings are a Reference Type. (They appear to be due the being Immutable.
Dim myString As String
Question: What is the value of MyString?
Quote
If 5 = 5 Then If "hello" = "hello" Then
etc.
You say for objects:
If This Is That Then If Me Is You Then
etc
= is for check the values are equal.
Is is for check they point the point to the same reference.
Dim StringA As String="</DREAM.IN.CODE>"
Dim StringB As String=StringA.ToUpper()
Console.WriteLine("A = B ({0})",(StringA = StringB).ToString)
Console.WriteLine("A Is B ({0})",(StringA Is StringB).ToString)
If TypeOf StringA Is String Then Console.WriteLine("A is a String")
If TypeOf StringB Is String Then Console.WriteLine("B is a String")
How would you write the code to check to see if MyString has no value. (Not the Empty String)?
Quote
And then the compare has two operators depending the job ('=' and Is). Way to complicate and obfuscate!
Assignment is easy to spot,
Imagine these two lines of code.
A = 0 ' Assign 0 to A C = (A = B)/> ' Assign the result of an equality check, to C
The are two different types of comparisons, cause there are two very basic but different things that could be check for. As explained above.
That's why I down repped you.
This post has been edited by AdamSpeight2008: 08 December 2010 - 09:56 AM

New Topic/Question
Reply



MultiQuote





|