My code is written in JavaScript
for (var i = 0; i < tsUA.length; i++) {
if (tsRU[i][0] === tsUA[i][0])
tsUA[i][2] = tsRU[i][1];
}
preferably using firstOrDefault
My code is written in JavaScript
for (var i = 0; i < tsUA.length; i++) {
if (tsRU[i][0] === tsUA[i][0])
tsUA[i][2] = tsRU[i][1];
}
preferably using firstOrDefault
Copyright © 2021 Jogjafile Inc.
In C# LINQ, you could do this:
Note, there isn't that much "LINQ" in here, you're modifying objects. LINQ is not designed to do that. And your request to use
FirstOrDefault()makes no sense, it has no place here.As you should probably notice, you're not gaining much by using LINQ here. Also, keeping your objects as arrays makes it less readable. Why not create proper objects to represent your data?