Select Git revision
Personalausweis.cs
Uwe Wienkop authored
Personalausweis.cs 788 B
using System;
using System.Collections.Generic;
using System.Text;
namespace _01_3_Personalausweis
{
public class Personalausweis
{
public string Name { get; private set; }
int id = 1000;
static int naechste_ID = 1000;
public Personalausweis(string Name)
{
this.Name = Name;
id = NaechsteID++;
}
public static int NaechsteID
{
get => naechste_ID;
set
{
if (value < naechste_ID)
throw new ArgumentOutOfRangeException("Neue ID darf nicht kleiner dem aktuellen Stand sein");
naechste_ID = value;
}
}
public override string ToString() => $"Name: {Name}, ID: {id}";
}
}