المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How to call List[int] in other class [modified]



C# Programming
11-11-2009, 01:18 AM
Please take a look at the code below ...

NOTE: [never mind square brackets, it is ment to be a list]


/*
my solution (not exacly what I need)
*/



Class Graph
{
int void ShortestPath(int SN, int StN)
{

...

List[int] GoThroughNode = new List[int]();
Path result = new Path();
result.printGoThroughNode(GoThroughNode);
}
}

class Path
{
public void printGoThroughNode(List[int] GTN)
{
foreach (int item in GTN)
{
Console.Write(item);
}
}
}

...

/*
so for every method in Class Path, in order to receive List[int]GoThroughNode(), i have to refer to result object in int void ShortestPath().

What I want is to get method(which contains List[int]GoThroughNode) from Class Graphs to use it in Class Path;
*/

modified on Monday, November 9, 2009 10:12 PM