Pages

Jan 28, 2008

How to compare 2 arraylist and find the one is the sublist of the other in c#


using System;
using System.Collections.Generic;

list declaration:
List RecipIDList = new List(new int[] { 1,2,3,4, 5, 7 });
List subList = new List(new int[] { 4, 5, 7 });


Function that does actual process:
// to find that the 2nd list is the sublist of the first one

public static string IndexOf(List RecipIDList, List subList)
{
int recipCount = 0;
int j = 0;
while (j < recipcount ="="">

No comments: