本文整理汇总了VB.NET中System.Type.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:VB.NET Type.GetHashCode方法的具体用法?VB.NET Type.GetHashCode怎么用?VB.NET Type.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Type 的用法示例。
在下文中一共展示了Type.GetHashCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: FieldsSample
' 导入命名空间
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
开发者ID:VB.NET开发者,项目名称:System,代码行数:35,代码来源:Type.GetHashCode
示例2: Type.GetHashCode()
' 导入命名空间
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
开发者ID:VB程序员,项目名称:System,代码行数:14,代码来源:Type.GetHashCode
注:本文中的System.Type.GetHashCode方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论