Warum kann ich keine "Konstante" innerhalb einer switch-Anweisung innerhalb des Aufgabenbereichs?

Mit diesem code:

public partial class Form1 : Form
{
    private static readonly int TABCONTROL_BASICINFO = 0;
    private static readonly int TABCONTROL_CONFIDENTIALINFO = 1;
    private static readonly int TABCONTROL_ROLESANDSECURITY = 2;
    private static readonly int TABCONTROL_INACTIVEINFO = 3;
. . .
int ActiveTabPage = tabControlWorker.SelectedIndex;
switch (ActiveTabPage) {
    case TABCONTROL_BASICINFO:
        if (currentNode == "NodeBuckingham") {
        } else if (currentNode == "NodeNamath") {
        } else if (currentNode == "NodeParsons") {
        } else {
        }
    break;

...Ich habe zu ersetzen "TABCONTROL_BASICINFO" mit "0" oder ich bekomme", Ein konstanter Wert ist
erwartet"

Himmel, Murgatroyd! Kann es nicht schauen und sehen, dass TABCONTROL_BASICINFO 0 ist?

  • Frustrierend, nicht wahr! Musst ein Aktuelles const anstatt die readonly-Statik 🙁
Schreibe einen Kommentar