Click to See Complete Forum and Search --> : how to call a funtion...


vvikingoo
July 2nd, 2008, 08:57 AM
hello,

i have a problem with c#, i´m new with these... Well, the problem is that i have a project with all my .cs and a library.dll that it is allready in the Debug folder. i have to run a function in learning.cs from my.cs, the code is this:

learning.cs

namespace PDL
{
public class C
{
.... code ....

public bool learn()
{
//the interest code//
}
}

In my.cs how can i call the function "public bool learn()" to start the code?


Thank u for ur time!

boudino
July 2nd, 2008, 09:51 AM
First, you need to have entry point (Main() method), second, you need a instance of the class C:

C c = new C();
bool r = c.learn();

Talikag
July 2nd, 2008, 03:54 PM
Or, you can make the 'learn' method static, and do the following:

bool b = C.learn();