Posted on: 5/9/2012 10:10:52 AM | Views : 314


//MatAlu is a simple class with only 2 properties.

//create a lsit to store all the instances
List<MatAlu> listMatAlu = new List<MatAlu>();

for(int rag=0;rag<=listMatAlu.Count;rag++)
{
    //create a instance
    MatAlu myMat = new MatAlu();
    
    //get the class value from the list
    myMat = listMatAlu[rag];

    //loop inside the instance and get the names/values
    foreach (item in myMat)   <<- ERROR !!
    {
        
    }              
}

the error is:
Error    3    foreach statement cannot operate on variables of type 'MatAlu' because 'MatAlu' does not con ...

Go to the complete details ...