Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Sa 08.09.07 18:07 
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
class Program
    {
        private int blubb()
        {
            ...
        }

        static void Main(string[] args)

Ich habe eine C#-Konsolenanwendung mit Visual C# 2005 Express erstellt. Soweit so gut.
Ich habe innerhalb der Klasse Program, die schon vorgegeben war, die statische Main-Routine (war auch schon da) und eine selbst geschriebene private Methode blubb. Die möchte ich nun aus Main heraus aufrufen. Wie mache ich das?
Versuche mit this.blubb() oder wie in Delphi self.blubb oder auch nur der Methodenname an sich scheiterten.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 08.09.07 18:27 
Tipp: Wie willst Du eine nicht-statische Methode aus einer statischen Methode aufrufen? Und was soll this in einer statischen Methode sein?

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".