473,398 Members | 2,120 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Referencing a C# class method without using the class name

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.

Nov 15 '05 #1
3 1751
Phil Myers <ph********@celaneseacetate.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
....AND less bugs

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Phil Myers <ph********@celaneseacetate.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #3
Obviously he chose the wrong language for the job if he wants that.
"Eric Newton" <er**@cc.ensoft-software.com> wrote in message
news:u0**************@tk2msftngp13.phx.gbl...
...AND less bugs

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Phil Myers <ph********@celaneseacetate.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Jon Slaughter | last post by:
I have a class that is basicaly duplicated throughout several files with only members names changing according to the class name yet with virtually the exact same coding going on. e.g. class...
5
by: kuvpatel | last post by:
Hi I want to refer a class called LogEvent, and use one of its methods called WriteMessage without actually having to create an instance of Logevent. I have tried using the word sealed with...
12
by: Mark Broadbent | last post by:
Hi guys, just going through remoting at the moment and a couple of questions relating to .net in general has surfaced. Firstly I have seen in the designer that for the namespace and many of its...
5
by: Amelyan | last post by:
I am struggling here trying to determine what is a good programming practice as far as referencing your URLs. When you use Response.Redirect, do you use 1) Hard-coded string --...
5
by: PJ | last post by:
I have a class defined as so: public class Pager : Control { private PagingList<T> itemList; .... I'm getting an error message that says, "The type or namespace name 'T' could not be found....
1
by: Tim F | last post by:
Problem: I'm receiving the error "File or assembly name XXXXX or one of its dependencies, was not found." when trying to execute code in an assmebly that has both a strong-name and has been...
9
by: Sagari | last post by:
Greetings, Sorry for a newbiw question: what is a most elegant and/or effective way to reference vars, methods and classes by their names in Python? To illustrate, PHP code: $a = ''b'; $$a...
0
by: DahrkDaiz | last post by:
Ok so I have a base class and several inherited classes. The base class has 3 Delegate Objects so that the inherited classes can redefine search functions (note, virtual will not work in this case)....
2
by: Andrus | last post by:
I need compile in-memory assembly which references to other in-memory assembly. Compiling second assembly fails with error Line: 0 - Metadata file 'eed7li9m, Version=0.0.0.0, Culture=neutral,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.