-
June 30th, 2010, 07:43 AM
#1
Finding error in an example code
Dear All,
I am new to C Sharp programming. And I am trying some data structure tutorial developed by great mentor Scott Mitchell at http://msdn.microsoft.com/en-US/libr...=VS.80%29.aspx
This is an example to develop a Tree structure with CSharp programming. Scott Mitchell has described the topic with great elaboration and he also added the code to implement this data structure. But on my try, I am getting an error from that code and it does not compile. I am getting error with NodeList class which derived from Collection<T> class. The NodeList<> class implementation is as follows:
public class NodeList<T> : Collection<Node<T>>
{
public NodeList() : base() { }
public NodeList(int initialSize)
{
// Add the specified number of items
for (int i = 0; i < initialSize; i++)
base.Items.Add(default(Node<T>));
}
public Node<T> FindByValue(T value)
{
// search the list for the value
foreach (Node<T> node in Items)
if (node.Value.Equals(value))
return node;
// if we reached here, we didn't find a matching node
return null;
}
}
But I can't compile this class as there is no definition of Items here. Can anyone please help me to correct this error?
It will be helpful if you browse the URL attache with this post....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|