-2

I'm trying to implement an example from this thread Databinding an enum property to a ComboBox in WPF but I need to translate it to VB.net. It's Martin Liversage's answer.

It's about these 2 lines:

this.valueToNameMap = this.type.GetFields(BindingFlags.Static | BindingFlags.Public).ToDictionary(fi => fi.GetValue(null), GetDescription);
this.nameToValueMap = this.valueToNameMap.ToDictionary(kvp => kvp.Value, kvp => kvp.Key);

Thanks!

Community
  • 1
  • 1
  • 4
    You could tried a very simple google search "convert c# to vb.net" an click on the first result –  Jun 11 '15 at 11:53
  • Sorry for being alive! I always used this one http://www.carlosag.net/Tools/CodeTranslator/ but it makes a mess of it. Didn't know about telerik. – user3891203 Jun 11 '15 at 12:39
  • No. people here are interested in only real programming problems, that you cannot find using search. –  Jun 11 '15 at 12:41

1 Answers1

1

Try this:

Me.valueToNameMap = Me.type.GetFields(BindingFlags.Static Or BindingFlags.Public).ToDictionary(Function(fi) fi.GetValue(Nothing), GetDescription)
Me.nameToValueMap = Me.valueToNameMap.ToDictionary(Function(kvp) kvp.Value, Function(kvp) kvp.Key)
Keith Mifsud
  • 725
  • 5
  • 16