Referencing a C# class method without using the class name

  • Thread starter Thread starter Phil Myers
  • Start date Start date
P

Phil Myers

I have a C# namespace called SAP_Message_Processor with a
class called App with a method called RunstateCreate. I
want to refer to the RunstateCreate method from another
class called AppMainStartup within the
SAP_Message_Processor namespace without using the App
prefix. This is possible in VB, the question is how do I
do this in C#?

Currently I an using the following statements:

namespace SAP_Message_Processor {
public class App {
public static void RunstateCreate() {
...
}
}
}

namespace SAP_Message_Processor {
public class AppMainStartup {
public static void Main() {
if (RunstateCreate()) {
...
}
}
}
public static bool RunstateCreate() {
App.RunstateCreate();
}
}
}

Any help that you can provide me on this issue would be
greatly appreciated.
 
Phil Myers said:
I have a C# namespace called SAP_Message_Processor with a
class called App with a method called RunstateCreate. I
want to refer to the RunstateCreate method from another
class called AppMainStartup within the
SAP_Message_Processor namespace without using the App
prefix. This is possible in VB, the question is how do I
do this in C#?

You can't. The C# design philosophy believes (correctly, IMO) that
explicitly stating the class name leads to greater readability.
 
....AND less bugs

Jon Skeet said:
You can't. The C# design philosophy believes (correctly, IMO) that
explicitly stating the class name leads to greater readability.
 
Back
Top