Update List Using Linq In Vb.net
I am a bit new to linq, I am only using linq for filtering the data. Now, I want to write a query for the below:
Con.Numbers is a dictionary, but now I converted it into a list, hence the above code wont work with list, could you please tell me how I can achieve it with Linq is the Con.NUmbers is a list. Thank you.
Additional Info:Class Structure is :
2 Answers
Don't know if I have misunderstood you somewhere.
Not sure why you want to use LINQ specifically. This is perfectly clear:
If for some reason you want LINQ-like syntax, you could use the List(T).ForEach
:
Linq Select Vb
For course, this is not 'real' LINQ, but again, I'm not sure why it would matter.
If you are really forced (?) to use LINQ, you might do:
Vb Linq Query
But of course the code is nonsense. Don't do this -- stick to what is clear and obvious, which in this case means just looping over the list.
EDIT
Fixed terrible misuse of Function
Vb Linq Examples
LINQ stands for Language Integrated Query. Query means retrieving data, so it's not so good for updating data. You maybe able to use it to retrieve another copy of the data that is updated, but not for directly updating the original.
If you want to make a new list with the data updated, you might do something like this:
BlueMonkMN