当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Filling arguments to IList<node>

问题描述:

I am doing merge sort with line-list. How to fill this with arguments, I mean test.

{

IList<Node> testas = new List<Node>();

Sort(testas);

}

网友答案:

IList is an interface and your custom class should implement this interface. This example on MSDN site might be helpful.

IList example on msdn

网友答案:

Ok Let me try to explain you this.

Lets take an example that you have a class called Node which has two properties defined like this

public class Node
{
string s1;
string s2;
}

now to call them the way you want, I think you should do like this

{
    IList<Node> testas = new List<Node>{s1="Abc" ,s2="Xyz"};
    Sort(testas);
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: