im trying to do loop throw objects in clas and check its data tybe and make control, if the data type is string so i want this item value to be empty. and if the data type is i
The foreach can iterate only on collections! The i variable in this case may be a list like this:
List<ProductionOrderItem> i = new List<ProductionOrderItem>();
Now you can iterate on it. The foreach iterate through the list:
foreach( ProductionOrderItem item in i)
{
if(item.data type is string)
{
item.value = "" ;
}
if ((item.data type is int)
{
item.value = 0 ;
}
if (item.data type is stringDateTime))
{
item.value = 2011-01-01 00:00:00;
}
else
// do any thing.
}
But remember: don't change the variable i within the loop.