Programmierkurs C-Sharp: Strukturen

Aus Wikibooks

Wechseln zu: Navigation, Suche

[Bearbeiten] Strukturen (struct)

Strukturen sind in C# Wertetypen (s. auch Referenztypen). Alle Datentypen sind in C# über Strukturen gelöst.

 public struct Koordinate
 {
   public double x;
   public double y;
   public double z;	
   public Koordinate(double x, double y, double z)
   {
     this.x = x;
     this.y = y;
     this.z = z;
   }
   public override string ToString()
   {
     return(string.Format("x: {0}, y: {1}, z: {2}", x, y, z));
   }
 }


--> vorheriges Kapitel Zugriffsmodifikatoren

--> nächstes Kapitel Aufzählungen (Enumerationen)

--> Übersicht Inhalt

Persönliche Werkzeuge