diff --git a/GBase/GBaseKey.cs b/GBase/GBaseKey.cs new file mode 100644 index 0000000..00ab036 --- /dev/null +++ b/GBase/GBaseKey.cs @@ -0,0 +1,30 @@ +// Author: Gockner, Simon +// Created: 2020-11-13 +// Copyright(c) 2020 SimonG. All Rights Reserved. + +using System; + +namespace GBase +{ + public class GBaseKey + { + private int _key = -1; + private bool _isSet; + + public int Key + { + get => _key; + internal set + { + if (_isSet) + throw new InvalidOperationException("Key is already set."); + + _key = value; + _isSet = true; + } + } + + public override string ToString() => $"{Key}"; + public static implicit operator int(GBaseKey key) => key.Key; + } +} \ No newline at end of file