• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

VB.NET Type.FullName属性代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了VB.NET中System.Type.FullName属性的典型用法代码示例。如果您正苦于以下问题:VB.NET Type.FullName属性的具体用法?VB.NET Type.FullName怎么用?VB.NET Type.FullName使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在System.Type的用法示例。



在下文中一共展示了Type.FullName属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。

示例1: TestFullName

Class TestFullName
   
    Public Shared Sub Main()
        Dim t As Type = GetType(Array)
        Console.WriteLine("The full name of the Array type is {0}.", t.FullName)
    End Sub
End Class
开发者ID:VB.NET开发者,项目名称:System,代码行数:7,代码来源:Type.FullName

输出:

The full name of the Array type is System.Array.


示例2: Example

' 导入命名空间
Imports System.Collections.Generic
Imports System.Globalization

Module Example
    Public Sub Main()
        Dim t As Type = GetType(String)
        ShowTypeInfo(t)

        t = GetType(List(Of))
        ShowTypeInfo(t)

        Dim list As New List(Of String)()
        t = list.GetType()
        ShowTypeInfo(t)

        Dim v As Object = 12
        t = v.GetType()
        ShowTypeInfo(t)

        t = GetType(IFormatProvider)
        ShowTypeInfo(t)

        Dim ifmt As IFormatProvider = NumberFormatInfo.CurrentInfo
        t = ifmt.GetType()
        ShowTypeInfo(t)
    End Sub

    Private Sub ShowTypeInfo(t As Type)
        Console.WriteLine($"Name: {t.Name}")
        Console.WriteLine($"Full Name: {t.FullName}")
        Console.WriteLine($"ToString:  {t}")
        Console.WriteLine($"Assembly Qualified Name: {t.AssemblyQualifiedName}")
        Console.WriteLine()
    End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:36,代码来源:Type.FullName

输出:

Name: String
Full Name: System.String
ToString:  System.String
Assembly Qualified Name: System.String, mscorlib, Version=4.0.0.0, Culture=neutr
al, PublicKeyToken=b77a5c561934e089

Name: List`1
Full Name: System.Collections.Generic.List`1
ToString:  System.Collections.Generic.List`1[T]
Assembly Qualified Name: System.Collections.Generic.List`1, mscorlib, Version=4.
0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Name: List`1
Full Name: System.Collections.Generic.List`1[[System.String, mscorlib, Version=4
.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
ToString:  System.Collections.Generic.List`1[System.String]
Assembly Qualified Name: System.Collections.Generic.List`1[[System.String, mscor
lib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorl
ib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Name: Int32
Full Name: System.Int32
ToString:  System.Int32
Assembly Qualified Name: System.Int32, mscorlib, Version=4.0.0.0, Culture=neutra
l, PublicKeyToken=b77a5c561934e089

Name: IFormatProvider
Full Name: System.IFormatProvider
ToString:  System.IFormatProvider
Assembly Qualified Name: System.IFormatProvider, mscorlib, Version=4.0.0.0, Cult
ure=neutral, PublicKeyToken=b77a5c561934e089

Name: NumberFormatInfo
Full Name: System.Globalization.NumberFormatInfo
ToString:  System.Globalization.NumberFormatInfo
Assembly Qualified Name: System.Globalization.NumberFormatInfo, mscorlib, Versio
n=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089


示例3: Example

' 导入命名空间
Imports System.Collections.Generic

Module Example
   Public Sub Main()
      Dim t As Type = GetType(List(Of))
      Console.WriteLine(t.FullName)
      Console.WriteLine()

      Dim list As New List(Of String)()
      t = list.GetType()
      Console.WriteLine(t.FullName)
   End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:14,代码来源:Type.FullName

输出:

System.Collections.Generic.List`1

System.Collections.Generic.List`1[[System.String, mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]


示例4: Example

' 导入命名空间
Imports System.Reflection

Module Example
   Public Sub Main()
      Dim t As Type = GetType(Nullable(Of )) 
      Console.WriteLine(t.FullName)
      If t.IsGenericType Then
         Console.Write("   Generic Type Parameters: ")
         Dim gtArgs As Type() = t.GetGenericArguments
         For ctr As Integer = 0 To gtArgs.Length - 1
            Console.WriteLine(If(gtArgs(ctr).FullName, 
                              "(unassigned) " + gtArgs(ctr).ToString()))
            If ctr < gtArgs.Length - 1 Then Console.Write(", ")   
         Next
         Console.WriteLine()
      End If
   End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:19,代码来源:Type.FullName

输出:

System.Nullable`1
Generic Type Parameters: (unassigned) T


示例5: Example

' 导入命名空间
Imports System.Reflection

Public Class GenericType1(Of T)
   Public Sub Display(elements As T())
   End Sub
   
   ' Visual Basic does not support pointer types.
   Public Sub HandleT(obj As T)
   End Sub
   
   
   Public Function ChangeValue(ByRef arg As T) As Boolean
      Return True
   End Function
End Class

Module Example
   Public Sub Main()
      Dim t As Type = GetType(GenericType1(Of ))
      Console.WriteLine("Type Name: {0}", t.FullName)
      Dim methods() As MethodInfo = t.GetMethods(BindingFlags.Instance Or
                                                 BindingFlags.DeclaredOnly Or
                                                 BindingFlags.Public)
      For Each method In methods 
         Console.WriteLine("   Method: {0}", method.Name)
         ' Get method parameters.
         Dim param As ParameterInfo = method.GetParameters()(0)
         Dim paramType As Type = param.ParameterType
         If method.Name = "HandleT" Then
            paramType = paramType.MakePointerType()
         End If
         Console.WriteLine("      Parameter: {0}", 
                           If(paramType.FullName, 
                              paramType.ToString() + " (unassigned)"))
      Next
   End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:38,代码来源:Type.FullName

输出:

Type Name: GenericType1`1
Method: Display
Parameter: T[] (unassigned)
Method: HandleT
Parameter: T* (unassigned)
Method: ChangeValue
Parameter: T& (unassigned)


示例6: Example

' 导入命名空间
Imports System.Reflection

Public Class Base(Of T)
End Class

Public Class Derived(Of T) : Inherits Base(Of T)
End Class

Module Example
   Public Sub Main()
      Dim t As Type = GetType(Derived(Of ))
      Console.WriteLine("Generic Class: {0}", t.FullName)
      Console.WriteLine("   Contains Generic Paramters: {0}",
                        t.ContainsGenericParameters)
      Console.WriteLine("   Generic Type Definition: {0}",
                        t.IsGenericTypeDefinition)                 
      Console.WriteLine()
      
      Dim baseType As Type = t.BaseType
      Console.WriteLine("Its Base Class: {0}", 
                        If(baseType.FullName,  
                        "(unassigned) " + baseType.ToString()))
      Console.WriteLine("   Contains Generic Paramters: {0}",
                        baseType.ContainsGenericParameters)
      Console.WriteLine("   Generic Type Definition: {0}",
                        baseType.IsGenericTypeDefinition)                 
      Console.WriteLine("   Full Name: {0}", 
                        baseType.GetGenericTypeDefinition().FullName)
      Console.WriteLine()
      
      t = GetType(Base(Of ))
      Console.WriteLine("Generic Class: {0}", t.FullName)
      Console.WriteLine("   Contains Generic Paramters: {0}",
                        t.ContainsGenericParameters)
      Console.WriteLine("   Generic Type Definition: {0}",
                        t.IsGenericTypeDefinition)                 
   End Sub
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:39,代码来源:Type.FullName

输出:

Generic Class: Derived`1
Contains Generic Paramters: True
Generic Type Definition: True

Its Base Class: (unassigned) Base`1[T]
Contains Generic Paramters: True
Generic Type Definition: False
Full Name: Base`1

Generic Class: Base`1
Contains Generic Paramters: True
Generic Type Definition: True



注:本文中的System.Type.FullName属性示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
VB.NET Type.IsNested属性代码示例发布时间:2022-05-24
下一篇:
VB.NET Type.BaseType属性代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap