Generic and nongeneric versions of the CompareTo method for Char value : Char « Data Types « VB.Net






Generic and nongeneric versions of the CompareTo method for Char value

   

Imports System

Class Sample
   Public Shared Sub Main()
      Try
      
         Dim a1 As [Char] = "A"c,   a2 As [Char] = "A"c
         Show(a1, a2, a1.CompareTo(a2), a1.CompareTo(CObj(a2)))
      Catch e As Exception
         Console.WriteLine(e)
      End Try
   End Sub

   Public Shared Sub Show(var1 As [Object], var2 As [Object], resultGeneric As Integer, resultNonGeneric As Integer)
      Console.WriteLine(var1)
      Console.WriteLine(var2)
      If resultGeneric = resultNonGeneric Then
         If resultGeneric < 0 Then
            Console.WriteLine("less than")
         ElseIf resultGeneric > 0 Then
            Console.WriteLine("greater than")
         Else
            Console.WriteLine("equal to")
         End If
         
      End If
   End Sub
End Class

   
    
    
  








Related examples in the same category

1.Four ways to declare CharactersFour ways to declare Characters
2.Create a Console Line by Repeating a CharCreate a Console Line by Repeating a Char
3.Display contents of charArrayDisplay contents of charArray
4.Char IsDigitChar IsDigit
5.Char IsLetterChar IsLetter
6.Char IsLetterOrDigitChar IsLetterOrDigit
7.Char IsLowerChar IsLower
8.Char IsUpperChar IsUpper
9.Char ToUpperChar ToUpper
10.Char ToLowerChar ToLower
11.Char IsPunctuationChar IsPunctuation
12.Char IsSymbolChar IsSymbol
13.Insert char to StringBuilder
14.Char.IsLowSurrogate() IsHighSurrogate() and IsSurrogatePair()
15.Char ToString.
16.Char.IsDigitChar.IsDigit
17.demonstrates IsSymbol
18.Char.CompareTo (Object)
19.Char.ConvertFromUtf32 converts the specified Unicode code point into a UTF-16 encoded string.
20.Convert the lone UTF-16 character to a code point
21.Convert the surrogate pair in the string at index position zero to a code point.
22.Char.GetNumericValue converts numeric Unicode character to a double-precision floating point number.
23.Char.GetUnicodeCategory categorizes Unicode character into a group identified by one of the UnicodeCategory values.
24.Char.IsControl indicates whether the specified Unicode character is categorized as a control character.
25.Char.IsControl tells whether the character is categorized as a control character.
26.Char.IsDigit Method tells whether the specified Unicode character is categorized as a decimal digit.
27.Char.IsHighSurrogate Method tells whether the specified Char object is a high surrogate.
28.Is each of the following characters a high surrogate?
29.Is each of the following characters a low surrogate?
30.Characters a surrogate pair
31.Char.IsLetter Method tells whether the specified Unicode character is categorized as a Unicode letter.
32.Char.IsLower Method tells whether the specified Unicode character is categorized as a lowercase letter.
33.Char.IsNumber Method tells whether the specified Unicode character is categorized as a number.
34.Char.IsPunctuation Method tells whether the specified Unicode character is categorized as a punctuation mark.
35.Char.IsSeparator Method tells whether specified Unicode character is categorized as a separator character.
36.Char.IsSeparator Method (String, Int32) tells whether character at specified position is a separator character.
37.Char.IsSurrogate tells whether the specified character has a surrogate code point.
38.Char.IsSymbol Method tells whether the specified Unicode character is categorized as a symbol character.
39.Char.ToString converts Unicode character to string
40.Create a string from a character array
41.Is Surrogate Pair
42.Use Char.IsPunctuation and Char.IsWhiteSpace to split words
43.Char Structure