小编use*_*017的帖子

实现ac#接口

我有一个名为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)

c# datatable interface

-7
推荐指数
1
解决办法
98
查看次数

标签 统计

c# ×1

datatable ×1

interface ×1