i've used short.parse(somestring) in past. i've seen confusing usage of short.parse() below:
var shortarray = array.convertall(stringarr, short.parse); so, array.convertall expects array , converter. well, fine! but how passing the short.parse as (or like) property? don't find such property in int16 struct. so, happening here actually?
array.convertall takes instance of converter<tin, tout> delegate second parameter. signature of delegate substantially same short.parse - both return value single argument.
the compiler convert 'method group' compatible delegate. known implicit method group conversion.
for comparison, explicit creation of delegate this:
array.convertall(stringarr, new converter<string, short>(short.parse)); so, answer question: it's still method, not property. doing here passing method delegate. providing convertall function call: when converts element in source array, execute short.parse(element) , use value returned in new array.
Comments
Post a Comment