Object class:
News publication entity
[Mapto ( " Us_news " )]
Public Abstract Class Newsbll
{
[Mapto ( " FID " )]
Public Abstract String Id { Get ;}
/// <Summary>
/// Title
/// </Summary>
[Mapto ( " Fcaption " )]
Public Abstract String Caption { Get ; Set ;}
/// <Summary>
/// News category PK-ss_Item.ID
/// </Summary>
[Mapto ( " FTYPE " )]
[Manytoone (localkey = " FTYPE " , Foreignkey = " FID " )]
Public Abstract Dictitembll type { Get ; Set ;}
/// <Summary>
/// News content
/// </Summary>
[Mapto ( " Fcontent " )]
Public Abstract String Content { Get ; Set ;}
/// <Summary>
/// Publisher
/// </Summary>
[Mapto ( " Fuserid " )]
Public Abstract String Userid { Get ; Set ;}
}
News category
[Mapto ( " Ss_item " )]
Public Abstract Class Dictitembll
{
[Mapto ("FID")]
Public Abstract IntId {Get;}
/// <Summary>
/// Group ID
/// </Summary>
[Mapto ( " Fclassid " )]
Public Abstract Int Classid { Get ; Set ;}
/// <Summary>
/// Parent node ID
/// </Summary>
[Mapto ( " Fparentid " )]
Public Abstract Int Parentid { Get ; Set ;}
/// <Summary>
/// Dictionary name
/// </Summary>
[Mapto ( " Fname " )]
Public Abstract String Name { Get ; Set ;}
# Endregion
}
1. Use Find to search for a single matching Value
Newsbll news = List. Find ( Delegate (Newsbll X)
{
Return X. type. ID = 10001 ; // Search for a single object with ID = 10001 in the category (type) Sub-object in the News list
});
2. Use findall to search for Multiple matching values.
List < Newsbll > Newslist = List. Find ( Delegate (Newsbll X)
{
Return X. type. ID = 10001 ; // Search for multiple objects with ID = 10001 in the category (type) Sub-object in the News list
});
3. Check whether the value meeting the condition exists using contains
Bool Iscontains = List. Find ( Delegate (Newsbll X)
{
Return X. type. ID = 10001 && X. userid = " Ejiyuan " ; // Search for the id = 10001 in the subobject of category (type) in the News list, and whether the publisher is ejiyuan.
});
4. Use foreach to operate on each list object
List. Find ( Delegate (Newsbll X)
{
X. Caption = " 10001 " ; // Change all titles in the list to 10001
});
5. sort by sort and by category ID
List. Sort ( Delegate (Newsbll X, documentbll y)
{
If (X. type. ID < Y. type. ID)
{
Return - 1 ;
}
Else If (X. type. ID = Y. type. ID)
{
Return 0 ;
}
Else Return 1 ;
});