vb System.Type.GetHashCode类(方法)实例源码

下面列出了vb System.Type.GetHashCode 类(方法)源码代码实例,从而了解它的用法。

作者:VB.NET开发    项目:Syste   
' 导入命名空间
Imports System.Security
Imports System.Reflection

' Compile this sample using the following command line:
' vbc type_gethashcode_getfields.vb /r:"System.Windows.Forms.dll" /r:"System.dll"

Class FieldsSample

    Public Shared Sub Main()
        Dim myType As Type = GetType(System.Net.IPAddress)
        Dim myFields As FieldInfo() = myType.GetFields((BindingFlags.Static Or BindingFlags.NonPublic))
        Console.WriteLine(ControlChars.Lf & "The IPAddress class has the following nonpublic fields: ")
        Dim myField As FieldInfo
        For Each myField In myFields
            Console.WriteLine(myField.ToString())
        Next myField
        Dim myType1 As Type = GetType(System.Net.IPAddress)
        Dim myFields1 As FieldInfo() = myType1.GetFields()
        Console.WriteLine(ControlChars.Lf & "The IPAddress class has the following public fields: ")
        Dim myField1 As FieldInfo
        For Each myField1 In myFields1
            Console.WriteLine(myField.ToString())
        Next myField1
        Try
            Console.WriteLine("The HashCode of the System.Windows.Forms.Button type is: {0}", GetType(System.Windows.Forms.Button).GetHashCode())
        Catch e As SecurityException
            Console.WriteLine("An exception occurred.")
            Console.WriteLine(("Message: " & e.Message))
        Catch e As Exception
            Console.WriteLine("An exception occurred.")
            Console.WriteLine(("Message: " & e.Message))
        End Try
    End Sub
End Class

作者:VB程序    项目:Syste   
' 导入命名空间
Imports System

public class MainClass
   Shared Sub Main()
        Dim i As Integer = 15
        Console.WriteLine(i.ToString())
        Console.WriteLine("Hash is: " + i.GetHashCode().ToString())
        Console.WriteLine("Type is: " + i.GetType().ToString)
        Console.WriteLine("Type full name is: " + i.GetType().FullName())
        Console.WriteLine("Type assembly qualified name is: " + i.GetType().AssemblyQualifiedName)
        Console.WriteLine("Namespace is: " + i.GetType().Namespace)
   End Sub
End Class


问题


面经


文章

微信
公众号

扫码关注公众号