n_srikanth4
asked on
How to find the records which are not in a arraylist
Hi
The explanation is like below.
i have a arraylist which contains
arraylist _upsRange=new arraylist{}
_upsRange array list contains {"13.11.2009","14.11.2009" ,"18.11.20 09"}.
iam building the datecodebasicobj lile below
foreach (IDateCodeBasicDTO val in lineDetails.DateCodeBasics )
{
DateCodeBasicDTO _dateCode = new DateCodeBasicDTO();
if (val.ItemDateCode != null)
{
_dateCode.CountUnitCode = val.CountUnitCode;
_dateCode.IouSize = val.IouSize;
_dateCode.ItemDateCode = val.ItemDateCode;
_dateCode.LayoutBcode = val.LayoutBcode;
_dateCode.LineNumber = val.LineNumber;
_dateCode.LocationCode = val.LocationCode;
_dateCode.Quantity = val.Quantity;
_dateCode.UpdTstmpField = val.UpdTstmpField;
datecodeBasicObj.Add(_date Code);
}
}
datecodebasicobj {"10.11.2009","11.11.2009" ,"12.11.20 09"}."13.1 1.2009","1 4.11.2009" ,"18.11.20 09"}.
i need to find out the records in datecodebasicobj which not in upsRange forecastlist.
the output will be {"10.11.2009","11.11.2009" ,"12.11.20 09"}
for (int i = 0; i <= _upsRange.Count; i++)
{
var datecodelist = from d in datecodeBasicObj
where d.ItemDateCode != _upsRange[0].ToString select d;
}
pls help me and send the logic for the above code.
codefile.txt
The explanation is like below.
i have a arraylist which contains
arraylist _upsRange=new arraylist{}
_upsRange array list contains {"13.11.2009","14.11.2009"
iam building the datecodebasicobj lile below
foreach (IDateCodeBasicDTO val in lineDetails.DateCodeBasics
{
DateCodeBasicDTO _dateCode = new DateCodeBasicDTO();
if (val.ItemDateCode != null)
{
_dateCode.CountUnitCode = val.CountUnitCode;
_dateCode.IouSize = val.IouSize;
_dateCode.ItemDateCode = val.ItemDateCode;
_dateCode.LayoutBcode = val.LayoutBcode;
_dateCode.LineNumber = val.LineNumber;
_dateCode.LocationCode = val.LocationCode;
_dateCode.Quantity = val.Quantity;
_dateCode.UpdTstmpField = val.UpdTstmpField;
datecodeBasicObj.Add(_date
}
}
datecodebasicobj {"10.11.2009","11.11.2009"
i need to find out the records in datecodebasicobj which not in upsRange forecastlist.
the output will be {"10.11.2009","11.11.2009"
for (int i = 0; i <= _upsRange.Count; i++)
{
var datecodelist = from d in datecodeBasicObj
where d.ItemDateCode != _upsRange[0].ToString select d;
}
pls help me and send the logic for the above code.
codefile.txt
If you see any compilation errors please tell me, and i will help you ...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
GOOD
Here is the logic that you need, notice that the needed filtered values will be stored in a new list of strings called cleanList.
List<string> cleanList = new List<string>();
for (int i = 0; i <= datecodebasicobj.Count; i++)
{
for (int x = 0; x <= _upsRange.Count; x++)
{
if(datecodebasicobj[i] != _upsRange[x])
{
cleanList.Add(datecodebasi
}
}
}