' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
﻿Imports System

Namespace E
    Public Interface IList(Of T)
        Default ReadOnly Property Item(ix As Integer) As T
    End Interface
    Public Interface IList
        Default ReadOnly Property Item(ix As Integer) As Object
    End Interface
    Public Class MyList(Of T As Class)
        Implements IList(Of T)
        Implements IList
        Public Default ReadOnly Property Item(ix As Integer) As T Implements IList(Of T).Item
            Get
                Console.WriteLine("IList<T>.Item")
                Return Nothing
            End Get
        End Property
        ReadOnly Property IList_Item(ix As Integer) As Object Implements IList.Item
            Get
                Console.WriteLine("IList.Item")
                Return Nothing
            End Get
        End Property
    End Class
    Public Class Program
        Public Shared Sub Main(args As String())
            Dim dummy As Object
            Dim o1 As IList(Of String) = New MyList(Of String)()
            dummy = o1(0)
            Dim o2 As IList = New MyList(Of String)()
            dummy = o2(0)
            Dim o3 As New MyList(Of String)()
            dummy = o3(0)
        End Sub
    End Class
End Namespace
