2017-02-06 4 views
1

엔티티 컬렉션에는 4 개의 엔티티가 있습니다. 이제 범위로 엔티티를 선택해야하는데 이는 처음 두 엔티티를 선택해야 함을 의미합니다.엔티티 컬렉션에서 엔티티 제거

그 후 엔터티 컬렉션에서 처음 두 엔터티를 제거하고 다음 두 엔터티를 선택해야합니다.

의사

Entitycollection EC = totalValues;//here totalValues having 4 entities. 
int startrange = 0; 
int uptoRange = 2; 
here i need to select the 0 to 2 Index entities from the entity Collection 
forloop (<loop the newly selected value >) 
{ 

} 

마지막으로 내가 선택한 값을 제거해야합니다.

+0

['EC.Take (3)'] (https://msdn.microsoft.com/en-us/library/bb503062(v=vs.110).aspx)는 어떻습니까? – DavidG

답변

0

는 목록에 그 실체 수집을 변환 한 후이 특정 범위의 것을 제거

list.RemoveRange(int index,int count); 

을한다.

0

을 사용하고이 시나리오를 수행하기 위해 사전 정의 된 방법을 사용할 수 있습니다.

**pseudocode** 

int startrange = 0; 
int uptoRange = 2; 
int totalloop = EC.Entities.count; 
for(int i=0;i<= totalloop;i++) 
{ 
foreach(Entity Ent in EC.Entities.skip(startrange).take(uptoRange)) 
{ 

} 
    startrange += uptoRange 
}