我有一个名为myResult的dataTable,它有两列Process和ParentProcess,我试图把它放到一个Ienumerable类型中,所以我可以用Json.net序列化它.
现在我到了这一点,我有这个界面:
namespace myFirstCProgramIn2013
{
public interface Interface1 : IEnumerable
{
string Process { get; set; }
string ParentProcess { get; set; }
}
}
Run Code Online (Sandbox Code Playgroud)
我在这个类中实现了它:
public class myArray : Interface1
{
public string Process
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
public string ParentProcess
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
public System.Collections.IEnumerator GetEnumerator()
{
throw new NotImplementedException();
}
}
Run Code Online (Sandbox Code Playgroud)
然后我尝试使用此类使用以下代码将myResult分配给它:
List<Interface1> recordList = …Run Code Online (Sandbox Code Playgroud)