i'm trying convert c# code found there in vb.net. write :
public function getlastfiles(byval countfiles integer) list(of fileinfo) return _ me._directory.getfiles().select(function (x) x).orderbydescending( function (x) x.lastwritetime).take(countfiles).tolist() end function
everything works fine, question : how can avoid function (x) x
that's lambda expression nothing..
you need list of fileinfo objects getfiles returns collection of strings. in order lastwritetime property need fileinfo object. select extension method doing you. try
me._directory.getfiles().select(function(x) new fileinfo(x)) .orderbydescending(function(x) x.lastwritetime) .take(5) .tolist()
Comments
Post a Comment