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 >)
{

}

最后我需要删除选定的值。

4

2 回答 2

0

将这些实体集合转换为列表,然后执行

list.RemoveRange(int index,int count);

这将删除该特定范围。

于 2017-02-06T14:48:41.650 回答
0

我们可以使用skip和take预定义的方法来实现这个场景。

**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 
}
于 2017-02-08T07:13:47.763 回答