This is a method that should take already assigned users out of a list and keep non-assigned ones in a list. The GuidList has the userId added to it on a button click. The profileList is used to populate a gridView.
Here is the code:
private VList<VW_profiles> FilterAssigned(VList<VW_profiles> profileList)
{
VList<VW_profiles> sortedList = new VList<VW_profiles>();
foreach(VW_profiles profile in profileList)
{
if(GuidList.Count > 0)
{
foreach(Guid userId in GuidList)
{
if(profile.UserId != userId)
{
sortedList.Add(profile)
}
}
}
else
{
sortedList = profileList;
}
}
return sortedList;
}
Now here's my problem. Everythings seems to work well up until all of the items in the profileList have also been added to the GuidList. Then instead of doing a negate on the two Guid ID's, we start adding everyone in again. Does anyone have any suggestions on how to do this is a more effecient way and to avoid the adding in once we've taken everything out.
Thanks!