Mega Code Archive

 
Categories / VB.Net / Data Types
 

String Equals Method

Imports System Imports System.Text Class Sample    Public Shared Sub Main()       Dim sb As New StringBuilder("abcd")       Dim str1 As [String] = "abcd"       Dim str2 As [String] = Nothing       Dim o2 As [Object] = Nothing       Console.WriteLine("    Is str1 equal to sb?: {0}", str1.Equals(sb))       Console.WriteLine("1b) String.Equals(Object). Object is a String.")       str2 = sb.ToString()       o2 = str2       Console.WriteLine(" *  The value of Object o2 is '{0}'.", o2)       Console.WriteLine("    Is str1 equal to o2?: {0}", str1.Equals(o2))       Console.WriteLine("    Is str1 equal to str2?: {0}", str1.Equals(str2))       Console.WriteLine("    Is str1 equal to str2?: {0}", [String].Equals(str1, str2))    End Sub 'Main End Class 'Sample