locked
Need help converting some code into linq RRS feed

  • Question

  • Hi all,

    I've got the followig code, which works but is verbose. Ive been looking at some of the linq examples and I think if I can get this code converted to linq and it will be much easier to read and less verbose.

    Anyone help me to achieve this please? Thanksing in advance

    Criteria<FolderProperty> folderCriteria = new Criteria<FolderProperty>();
                folderCriteria.AddFilter(FolderProperty.Id, CriteriaFilterOperator.EqualTo, tmpContent.FolderId);
                folderCriteria.Columns.Clear();
                folderCriteria.Columns.Add(FolderProperty.ParentId);
                folderCriteria.PagingInfo = new PagingInfo(1);
    
                tmpFolder = folderManager.GetList(folderCriteria).FirstOrDefault();
    
                Criteria<ContentProperty> contentCriteria = new Criteria<ContentProperty>();
                contentCriteria.Columns.Clear();
                contentCriteria.Columns.Add(ContentProperty.Id);
                contentCriteria.AddFilter(ContentProperty.FolderId, CriteriaFilterOperator.EqualTo, tmpFolder.ParentId);
                contentCriteria.OrderByField = ContentProperty.Title;
                contentCriteria.OrderByDirection = EkEnumeration.OrderByDirection.Ascending;
                contentCriteria.PagingInfo = new PagingInfo(1);
                tmpContent = contentManager.GetList(contentCriteria).First();
    

     

    Tuesday, November 15, 2011 2:05 PM

Answers

All replies