The value of the qty variable will be 80 after executing the Assign activity. This is because the expression in the Assign activity is using the LINQ methods AsEnumerable, SkipWhile, and Item to access the data in the dt variable. The dt variable is a DataTable that contains the following data:
Item
Quantity
apple
5
banana
10
mango
20
orange
80
grape
40
The AsEnumerable method converts the DataTable into an Enumerable collection of DataRow objects. The SkipWhile method skips the elements of the collection until the condition is false. The condition is a lambda expression that checks if the value of the Item column is equal to “mango”. The (0) indexer returns the first element of the collection after skipping. The Item method accesses the value of the Quantity column of the DataRow. The ToString method converts the value into a string. Therefore, the expression will skip the first three rows of the DataTable and return the value of the Quantity column of the fourth row, which is 80. References: [DataTable.AsEnumerable Method], [Enumerable.SkipWhile Method], [DataRow.Item Property]
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit