how to call a method that is in another file in c#?

how to call a method that is in another file in c#?
3 Replies
not_daniel1
not_daniel1OP2y ago
In Program.cs file:
namespace Insim_Base
{
public class Program
{
public static Timer Luz1 = new Timer();
namespace Insim_Base
{
public class Program
{
public static Timer Luz1 = new Timer();
In Luz.cs file:
Luz1.Enabled = true;
Luz1.Enabled = true;
mtreit
mtreit2y ago
What file something is in is not really relevant. Everything in C# is part of some class and if you need to access something you do it via either a class instance or, if it's static, via the type. In your example:
Program.Luz1.Enabled = true;
Program.Luz1.Enabled = true;
Since Luz1 is static you access it via the type it is defined in, in this case Program.
not_daniel1
not_daniel1OP2y ago
Thank you very much, it worked
Want results from more Discord servers?
Add your server