Autor Beitrag
zero_x
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 30



BeitragVerfasst: So 20.01.08 22:51 
Hallo liebes Forum,

Mir ist es etwas peinlich die Frage zu stellen, aber naja.

Kann ich hier über die Kommandozeile werte in der Programm übertragen und es wiedergeben? Wenn ja, wie mache ich das?

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
using System;

class MainParam
{
    public static void Main(string[] args)
    {
        int counter = 0;

        foreach (string arg in args)
            Console.WriteLine("Argument #{0}: {1}", counter++, arg);
    }
}


Danke im voraus! ;)


MfG
Zer0_X

Moderiert von user profile iconChristian S.: Code- durch C#-Tags ersetzt
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 20.01.08 22:59 
Der Code sieht richtig aus :nixweiss:
Vielleicht verstehe ich die Frage auch nicht :gruebel:

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
zero_x Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 30



BeitragVerfasst: So 20.01.08 23:03 
user profile iconChristian S. hat folgendes geschrieben:
Vielleicht verstehe ich die Frage auch nicht :gruebel:

Gut das der Code richitg ist :P Kurz: Wie mache ich das?
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 20.01.08 23:15 
Ach so, Du meinst wie man das beim Debuggen in der IDE macht? In den Projekt-Eigenschaften in der Abteilung "Debug" gibt es ein Feld "Command line arguments", da kannst Du die eintragen.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
zero_x Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 30



BeitragVerfasst: So 20.01.08 23:30 
Okay, Danke! :P

Noch eine kleine Frage: Wofür/Wann/Wieso/Warum werdendet man das?


Lg
Zer0_x
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 20.01.08 23:37 
Wenn Du z.B. beim Start Dateinamen übergibst, sodass das Programm die automatisch beim Start öffnet. Wenn Du z.B. "notepad somefile.txt" schreibst, wird Notepad direkt diese Datei öffnen.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
zero_x Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 30



BeitragVerfasst: So 20.01.08 23:40 
Cool 8) Danke ;) !!