public override int get_VecItem(int hvo, int tag, int index)
{
ITestItem tester;
if (!m_filterFlids.TryGetValue(tag, out tester))
return base.get_VecItem(hvo, tag, index);
int chvoReal = BaseSda.get_VecSize(hvo, tag);
using (ArrayPtr arrayPtr = MarshalEx.ArrayToNative<int>(chvoReal))
{
BaseSda.VecProp(hvo, tag, chvoReal, out chvoReal, arrayPtr);
int[] candidates = MarshalEx.NativeToArray<int>(arrayPtr, chvoReal);
int iresult = 0;
for (int icandidate = 0; icandidate < candidates.Length; icandidate++)
{
if (tester.Test(candidates[icandidate], BaseSda, m_validHvos))
{
if (iresult == index)
return candidates[icandidate];
iresult++;
}
}
throw new IndexOutOfRangeException("filtered vector does not contain that many items (wanted " + index +
" but have only " + iresult + ")");
}
}