Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,104 questions

40,777 answers

573 users

How to print a read-only IList wrapper around an array in VB.NET

1 Answer

0 votes
Module Module1

    Sub Main()

        Dim arr As String() = {"VB.NET", "C", "C++", "PHP", "C#"}

        Dim ilist As IList(Of String) = Array.AsReadOnly(arr)

        PrintIndexAndValues(ilist)

    End Sub

    Public Sub PrintIndexAndValues(ilist As IList(Of String))
        Dim i As Integer
        For i = 0 To ilist.Count - 1
            Console.WriteLine("({0}) : {1}", i, ilist(i))
        Next i
    End Sub

End Module

' run:
' 
' (0) : VB.NET
' (1) : C
' (2) : C++
' (3) : PHP
' (4) : C#

 





answered Apr 8, 2016 by avibootz
...