functionwhoreturnlist(cmd)[0]
+10
A:
It is short-hand for:
List<Whatever> list = functionwhoreturnlist(cmd);
Whatever whatever = list[0];
Dean Harding
2010-06-08 05:57:10
A:
Seems like cmd is an SQL command which returns may be array of some kind like DataTable[] and this function gets only first element(DataTable) from the array.
Shoaib Shaikh
2010-06-08 05:57:38
WOW!!!! That is impressive! Now quickly, what lottery numbers are coming up next week?
Sani Huttunen
2010-06-08 06:12:09
+1
A:
The return type of functionwhoreturnlist is an object, like a List or an array that can be accessed via an indexer. The code is calling the function, which is then returning the List or array and then using the indexer to reference the first element in the collection.
An example would be:
var cmd = "123";
var returnedObj = functionwhoreturnlist(cmd)[0];
private List<string> functionwhoreturnlist(cmd)
{
return new List<string> {cmd};
}
lomaxx
2010-06-08 06:02:53
A:
This statement can be used for all methods whose return type has a numeric indexer (e.g. lists or arrays).
schaermu
2010-06-08 06:04:00
+2
A:
The function returns a list, and you just access element 0 in the returned list.
Marthinus
2010-06-08 06:13:35