how to find last version no from a list<> in C#

Posted by Rohit on Stack Overflow See other posts from Stack Overflow or by Rohit
Published on 2010-06-17T07:31:27Z Indexed on 2010/06/17 7:43 UTC
Read the original article Hit count: 184

Filed under:
|

I have a entity class RenderingTemplates. Inside this i have a property List which holds all versions of rendering template. RenderingTemplateVersion has a property VersionName which stores version name as "Version 1.0".

I am creating a new version and want to find last version no.so that i can append it by 1 and make new VersionName as "Version 2.0".

To accomplish this i have

LatestVersion =  template.RenderingTemplateVersionList.OrderByDescending(e => e.VersionName.Split(new char[] { ' ', '.' })[1]).First()

LatestVersion is a integer. How to convert this to integer.Please help or suggest some other way.

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ