Autor Beitrag
CanPolat
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Fr 08.05.09 18:42 
also kann man ne string variable als auswahl benutzen?

so in etwa funktioniert es schonmal nicht;)

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
                string auswahl;

                Console.Write("triff deine auswahl 1,2,a oder b: ");
                auswahl = Console.ReadLine();

                switch (auswahl)
                {
                    case (1):
                        Console.Write("1");
                        Console.Read();
                        break;
                    case (2):
                        Console.Write("2");
                        Console.Read();
                        break;
                    case (a):
                        Console.Write("a");
                        Console.Read();
                        break;
                    case (b):
                        Console.Write("b");
                        Console.Read();
                        break;


edit: wollte noch sagen das ich schon bei "msdn.microsoft.com", "http://openbook.galileocomputing.de/visual_csharp/" und nochmal beim Index von c# nachgeschaut, aber nicht darüber gefunden><
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Fr 08.05.09 20:35 
user profile iconCanPolat hat folgendes geschrieben Zum zitierten Posting springen:
wollte noch sagen das ich schon bei "msdn.microsoft.com", "http://openbook.galileocomputing.de/visual_csharp/" und nochmal beim Index von c# nachgeschaut, aber nicht darüber gefunden><
Dann schau nochmal ;) . In der englischen VS-Hilfe beispielsweise unter "switch statement [C#]" zu finden, das Online-Pendant gibt's hier: msdn.microsoft.com/e...ibrary/06tc147t.aspx

_________________
>λ=
CanPolat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38



BeitragVerfasst: Fr 08.05.09 22:02 
danke
und ich war genau auf dieser seite und habe es mir ca 12std lang angesehen >.<
bin aber nicht auf die idee gekommen ganz unten genauer zu schauen .(
den case ruf müsste ich nur in zwei aunführungzeichen(") sezen^^
...

wenn man glaubt, dümmer gehts nicht mehr, kommt von irgendwo ein CanPolat her ;=)

...

danke nochmal
MfG