Getting dictionary <string, string> from list <Control>
I want a dictionary containing the names and text of all controls. Is this possible with the predefined LINQ / colection structure / initializer methods or do I have to create a loop and add all the entries myself?
This gives me an error message:
List<Control> controls;
// .. initialize list ..
controls.ToDictionary((Control child,string k)=>new KeyValuePair<string,string>(child.Name, child.Text));
+2
a source to share