Autor Beitrag
shil
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 143

Windows Xp
C#
BeitragVerfasst: Di 28.11.06 15:53 
hi, ich hab da mal wieder ein prob.
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:
24:
25:
26:
27:
28:
29:
 class FieldDefinition
    {
        private string mName;
        private string mDataTyp;

        public string Name 
        {

            get { return mName; }
            //TODO: Hier sind mit Sicherheit nicht alle Eingaben zulässig (leerer String, Leerzeichen im Namen etc.)
            //Tip: System.Text.RegularExpressions
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    mName = value;
                }
                else
                {                  
                    throw new FieldDefinitionException("Der Feldname darf nicht leer sein""???");
                }                
            }
        }
        public DatenTyp DataTyp
        {
            get { return mDataTyp; }
            set { mDataTyp = value; }
        }
    }

folgendes problem habe ich.
ich soll überprüfen ob die eingabe des benutzers bezüglich des datentyps erlaub ist. (richtiger wert) deshalb hab ich eine enum erstellt.
mein frage ist, wie kann ich jetzt prüfen ob das was der benutzer eingegeben hat in meiner enum steht?

p.s:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
public enum DatenTyp
    {
        VarChar,
        Integer,
        Boolean,
        Text
    }

(das ist meine enum)
Robert_G
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 416


Delphi32 (D2005 PE); Chrome/C# (VS2003 E/A, VS2005)
BeitragVerfasst: Di 28.11.06 16:27 
Schaue dir mal Enum.Parse in den .Net SDK Docs an.