CodeMonkey775 0 Newbie Poster

I'm having problems passing a variable to a method which is executed and compiled using CodeDom. The situation is I have a List<CellData> with cells, each containing a formula (like Excel). I am trying to pass this list to an executable section of code which is compiled during run-time. The formulas are calculated in CodeDom and the result is returned on the same List<CellData> object I passed.

The user-defined class which holds the cell data is defined here:

public class CellData
{
private int row;
private int level;
private int column;
private string formula;
private object result;
private List<CellData> children;

public int Row { get { return row; } set { row = value; } }
public int Column { get { return column; } set { column = value; } }
public int Level { get { return level; } set { level = value; } }
public string Formula { get { return formula; } set { formula = value; } }
public object Result { get { return result; } set { result = value; } }
public List<CellData> Children { get { return children; } set { children = value; } }

// Constructor
public CellData(int CellRow, int CellColumn, int CellLevel, string CellFormula)
{
row = CellRow;
column = CellColumn;
formula = CellFormula;
level = CellLevel;

children = new List<CellData>();
}
}

Since I needed the compiled CodeDom code to know what a CellData object was, I replicated that within the CodeDom code. The compiled code looks something like this:

using System;
using System.Collections;
using System.Collections.Generic;

namespace C_Tech_Programmer
{
public class Code
{
// Calculate all of the formulas
public List<CellData> Calculate(List<CellData> calcList)
{
calcList[0].Result = 7 * 7 * 9;
return calcList;
}
}

public class CellData
{
private int row;
private int level;
private int column;
private string formula;
private object result;
private List<CellData> children;
public int Row { get { return row; } set { row = value; } }
public int Column { get { return column; } set { column = value; } }
public int Level { get { return level; } set { level = value; } }
public string Formula { get { return formula; } set { formula = value; } }
public object Result { get { return result; } set { result = value; } }
public List<CellData> Children { get { return children; } set { children = value; } }

// Constructor
public CellData(int CellRow, int CellColumn, int CellLevel, string CellFormula)
{
row = CellRow;
column = CellColumn;
formula = CellFormula;
level = CellLevel;

children = new List<CellData>();
}
}
}

To executed the compiled code, I pass my list of CellData objects to the Invoke method for the CodeDom code.

List<CellData> result = new List<CellData>();

result = (List<CellData>)mi.Invoke(assemblyInstance, new object[] { calcOrder });

The problem is that it won't make the conversion from the CellData class in my normal code to the CellData class in the CodeDom compiled code. This is the error that comes up:

{"Object of type 'System.Collections.Generic.List`1[C_Tech_Programmer.CellData]' cannot be converted to type 'System.Collections.Generic.List`1[C_Tech_Programmer.CellData]'."}

I have checked both classes over and they look exactly the same to me. If there is some sort of way to convert these, or even a better way to go about doing this, I would be much obliged to know how.

Thanks,
Dan