How get key of highest key of a dictionary in VB.NET

2 Answers

0 votes
Imports System
Imports System.Linq
Imports System.Collections.Generic

Public Class Program
	Public Shared Sub Main()
		Dim dict = New Dictionary(Of String, Integer)() From {
					{"c#", 2},
					{"c++", 5},
					{"vb.net", 9},
					{"java", 7},
					{"c", 1},
					{"rust", 3}
				}


        Console.WriteLine(dict.Keys.Max())
    End Sub
End Class





' run:
'
' vb.net
'

 



answered Aug 11, 2023 by avibootz
0 votes
Imports System
Imports System.Linq
Imports System.Collections.Generic

Public Class Program
	Public Shared Sub Main()
		Dim dict = New Dictionary(Of Integer, String)() From {
					{2, "c#"},
					{5, "c++"},
					{9, "vb.net"},
					{7, "java"},
					{1, "c"},
					{3, "rust"}
				}


        Console.WriteLine(dict.Keys.Max())
    End Sub
End Class





' run:
'
' 9
'

 



answered Aug 11, 2023 by avibootz

Related questions

2 answers 166 views
5 answers 222 views
2 answers 109 views
1 answer 171 views
1 answer 108 views
1 answer 179 views
179 views asked Sep 26, 2018 by avibootz
...