So, there is currently a piece of code that looks like this ...
string name = GetValues(sequenceOfCodes, 0, IDtoMatch, 1)[0];
I just updated the following line to be
string name = sequenceOfCodes .Select(x => x[0]) .Where(x => x == IDtoMatch) .FirstOrDefault();
Hope we will return the same.
sequenceOfCodes is a List<List<String>> , and IDtoMatch also a string .
So, hopefully, all this seems wonderful.
However, when I go to compilation, I get an odd error
The type 'System.Windows.Forms.ComboBox' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
And when I take my newly added code, it compiles and runs ... So why is it just because I added lambda expression , it believes that I need a link to System.Windows.Forms.ComboBox ?
Just indicate that this application is console . Not a winforms application.
----------- UPDATE ----------
So, I found that one of the links refers to System.Windows.Forms, which I really disappoint, as this is the main code and should not have such dependencies :(
However, I am still wondering why the error did not appear before I added my line of code.
To confirm, if I delete my code, I can close VS down, restart and rebuild, and everything is fine. If I add my line of code, close and restart, etc. An error will appear during recovery.
A very strange mistake for me.
Thank you guys for your help.