Autor Beitrag
storestore
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 397
Erhaltene Danke: 7

WIN 7
C#
BeitragVerfasst: Fr 16.09.11 21:33 
Hey,
ich hatte folgendes programmiert:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
static void Main(string[] args)
        {
            int zahl = 1;
           while(zahl<=100)

{
int rechnen;
rechnen= zahl*zahl;
console.WriteLine(zahl);
console.ReadLine
zahl++;
}

Plötzschlich, nach 100x maligen "Enter" drücken stürtzt visual c# ab!
Dann öffne ich die datei nochmal, und was passiert?!
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
  static void Main(string[] args)
        {
            int zahl = 1;
            string text = Console.ReadLine();
            if (int.TryParse(text, out zahl)) ;
            else
            {
                Console.WriteLine("Hallo");
                Console.ReadLine();
            }
//nicht erfolgreich

Das steht dan drin!
Merkwürdig!

Moderiert von user profile iconTh69: Titel geändert.
Moderiert von user profile iconTh69: Topic aus C# - Die Sprache verschoben am Sa 17.09.2011 um 08:22

_________________
Der Pc ist nur so schlau, wie derjenige der in steuert!
"Don't Quit. Suffer now, and live the rest of your life as a champion"
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Fr 16.09.11 22:09 
Deine Entwicklungsumgebung ist abgestürzt (warum auch immer). Du hattest deinen Code nicht gespeichert. Beim Neustarten der IDE wird die letzte gespeicherte Version geladen.

Wo ists jetzt das Problem? Was hat das mit einer Schleife zu tun und warum soll diese "nicht erfolgreich" sein?

Speichere einfach deinen Code regelmäßig ab und gut ists :roll:

_________________
Delphi: XE - OS: Windows 7 Professional x64
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19326
Erhaltene Danke: 1749

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 17.09.11 08:57 
user profile iconHorschdware hat folgendes geschrieben Zum zitierten Posting springen:
Speichere einfach deinen Code regelmäßig ab und gut ists :roll:
Das sollte C# eigentlich automatisch machen, das ist jedenfalls die Standardeinstellung:

VS2010OptionsAutoSave
Einloggen, um Attachments anzusehen!
storestore Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 397
Erhaltene Danke: 7

WIN 7
C#
BeitragVerfasst: Sa 17.09.11 14:01 
Nein,
ich habe das Programm debuggt und 100 mal Enter gedrückt! Nach dem Hundersten mal ist nicht nur das Programm sondern auch Visual c# abgestürtzt! Dann habe ich Visual c# neu gestartet und es kam folgender code:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
 static void Main(string[] args)
        {
            int zahl = 1;
            string text = Console.ReadLine();
           <span style="color: red"if (int.TryParse(text, out zahl)) ;
            else
            {
                Console.WriteLine("Hallo");
                Console.ReadLine();
            }</span>
<span style="color: red">//nicht erfolgreich</span>

Das rote hatte ich gar nicht geschrieben! Das kam von alleine!

_________________
Der Pc ist nur so schlau, wie derjenige der in steuert!
"Don't Quit. Suffer now, and live the rest of your life as a champion"