今日は Asc 関数 です。
msdn には「文字に対応する文字コードを表す整数型 (Integer) の値を返します。」とあります。
VB6 で使っていた AscB 関数は VB.NET のコード体系が Unicode になったのでサポートされなくなったらしいです。
いずれにしても、あまり使う機会がなかったなぁ。
Option Strict On
Imports System.Security.Permissions
Imports System.Runtime.InteropServices
Imports System.ComponentModel
Public NotInheritable Class Functions
#Region " AppActivate "
AppActivate 関数 参照
#End Region
#Region " GetResourceString "
AppActivate 関数 参照
#End Region
#Region " Asc "
    Public Shared Function Asc(ByVal [String] As String) As Integer
        If (([String] Is Nothing) OrElse ([String].Length = 0)) Then
            Throw New ArgumentException(GetResourceString("Argument_LengthGTZero1", New String() {"String"}))
        End If
        Dim ch As Char = [String].Chars(0)
        Dim num As Integer
        Dim num2 As Integer = Convert.ToInt32(ch)
        If (num2 < &H80) Then
            Return num2
        End If
        Dim buffer As Byte()
        Dim fileIOEncoding As System.Text.Encoding = System.Text.Encoding.Default
        Dim chars As Char() = New Char() {ch}
        If fileIOEncoding.IsSingleByte Then
            buffer = New Byte(1 - 1) {}
            Dim num3 As Integer = fileIOEncoding.GetBytes(chars, 0, 1, buffer, 0)
            Return buffer(0)
        End If
        buffer = New Byte(2 - 1) {}
        If (fileIOEncoding.GetBytes(chars, 0, 1, buffer, 0) = 1) Then
            Return buffer(0)
        End If
        If BitConverter.IsLittleEndian Then
            Dim num4 As Byte = buffer(0)
            buffer(0) = buffer(1)
            buffer(1) = num4
        End If
        num = BitConverter.ToInt16(buffer, 0)
        Return num
    End Function
#End Region
End Class