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

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,850 questions

51,771 answers

573 users

How to print only the keys from a dictionary in VB.NET

1 Answer

0 votes
Imports System
Imports System.Collections.Generic
                 
Public Module Module1
	Public Sub printOnceKey(arr() As Integer) 
		Dim dict As Dictionary(Of Integer, Integer) = New Dictionary(Of Integer, Integer)
		
		For i As Integer = 0 To arr.Length - 1
			dict.Add(arr(i), i) 
		Next
		
		Dim keys As Object   = dict.Keys
		For Each n As Integer In keys
    		Console.Write("{0, 3}", n)
		Next
	End Sub
    Public Sub Main()
        Dim arr() As Integer = {12, 11, 18, 19, 30}
  
        printOnceKey(arr)
    End Sub
End Module
     
     
     
' run:
'
'   12 11 18 19 30
'
	

 



answered May 4, 2020 by avibootz

Related questions

1 answer 149 views
1 answer 145 views
1 answer 215 views
1 answer 153 views
1 answer 105 views
1 answer 133 views
...