ctype_typeparameter3.vb

来自「大名鼎鼎的mono是.NET平台的跨平台(支持linux」· VB 代码 · 共 32 行

VB
32
字号
Class CType_TypeParameter3    Sub Main()    End Sub    'An array whose element type is a type parameter with an interface constraint I     'has the same covariant array conversions as an array whose element type is I.     'These tests fail in vbc??    'Sub ToTI(Of T As I)()    '    Dim fromvalue As I()    '    Dim tovalue As T()    '    tovalue = CType(fromvalue, T())    'End Sub    'Sub FromTI(Of T As I)()    '    Dim fromvalue As T()    '    Dim tovalue As I()    '    tovalue = CType(fromvalue, I())    'End Sub    'Interface I    'End Interface    'An array whose element type is a type parameter with a class constraint C     'has the same covariant array conversions as an array whose element type is C.    Sub FromTC(Of T As C)()        Dim fromvalue As T()        Dim tovalue As C()        tovalue = CType(fromvalue, C())    End Sub    Class C    End ClassEnd Class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?