asp.net - how to find the max id from a generic list -


I am getting a collection of data in the object of the list and I want to get the maximum id.` from this list > objinfo dim list (as AlbumInfo) = objPhotos.GetPhotos_Alb_ID (Me.ModuleId, hdd_AlbID.Value) dim as the string Photo_Image = "" dim string string = photos_isages & amp; Fu_Photo.PostedFile.FileName.Substring (fu_Photo.PostedFile.FileName.LastIndexOf () ".") If objinfo.Count & gt; = 1 then Photo_Image = Convert.ToString (hdd_AlbID.Value) + "_" + Convert.ToString (objinfo .emem ("0"). Photo_Id +1) Otherwise Photo_Image = Convert.ToString (hdd_AlbID.Value) + "_" + Convert.ToString ("1") end then

Returns Convert.ToString (objinfo.Item ("0"). Photo_Id +1) The "0" id, but I want to get the ID of the last item.

OK, you specified maximum in the title, and In the last question, here are both:

Maximum:

  Photo_Image = hdd_AlbID.Value.ToString () & amp; "_" & Amp; _ Objinfo.Max (function (o) o.Photo_Id) _ .Photo_Id.ToString ()   

Last:

  Photo_Image = hdd_AlbID.Value.ToString () & Amp; "_" & Amp; _ Objinfo.Last (). Photo_Id.ToString ()    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -