0

How convert function operator from c# into vb.net,
If i have this code:

Dictionary<string, string> sd = new Dictionary<string, string>();
string sKey = sd.Single(kvp => kvp.Value.Equals("A value")).Key;

how to convert it to vb.net?
I am trying to get the Key name from a dictionary list

1
  • 5
    First, the code has nothing to do with "pointers". Second, what does "access through a pointer" mean? .NET doesn't use pointers and member access is the same in both languages. The statement is very simple, have you tried to convert it to VB.NET? What problems did you encounter? Commented Sep 14, 2015 at 8:32

2 Answers 2

2

this one should do

dim sd as new Dictionary(of string, string)()
dim sKey = sd.Single(function(kvp) kvp.Value.Equals("A value")).Key

as you can see it's basically just adding dim (usually instead of var), removing the ;, changing <...> into (of ...) and => into function(...) ...

Sign up to request clarification or add additional context in comments.

Comments

0

Carsten already answered you, but with these conversion problems you can always look at this online conversion tool.

For your code the tool gives:

Dim sd As New Dictionary(Of String, String)()
Dim sKey As String = sd.[Single](Function(kvp) kvp.Value.Equals("A value")).Key

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.