parent
168823cfde
commit
e29b7cbafd
1 changed files with 30 additions and 0 deletions
@ -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; |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue