Fehmi Aksakal
Fehmi Aksakal

Reputation: 51

How can I invoke function from another function?

I'm new on the C# and I have one question. I have one function for this job.

The function is static:

   FilterMethods.GetEmpDiscount(item.campaigns)   
//item.campaings type  a Class,  this function return decimal value.

How Can I Invoke this function at other function.

Upvotes: 0

Views: 137

Answers (1)

Mighty Badaboom
Mighty Badaboom

Reputation: 6155

static void DoSomething()
{

}

static void DoSomethingElse()
{ 
    DoSomething();
}

But this only works if the calling function is static as well.

If they are in different classes you have to write 'classname.DoSomething();' while classname is the name of the class which contains the 'DoSomething()' method.

Keep in mind that the access-modifiers are valid.

Upvotes: 1

Related Questions