let me start right away with the code:
class Item {
public int highestBuyOffer;
public int lowestSellOffer;
[...]
}
I would like to prevent people using this class from accidently assigning a buy offer value to a sell offer value and the other way round (like someBuyOffer = someSellOffer
). That's why I want to create my own types:
class Item {
public BuyOffer highestBuyOffer;
public SellOffer lowestSellOffer;
[...]
}
Creating a struct for it seems overkill, as these both of values should behave exactly like an int.
The using
directive is not what I want because:
- It is only valid for one file
- It does not count as a type, it's just a synonym
I made this class to cover identical needs:
And to consume it in your case:
If you need to be able to serialize it (Newtonsoft.Json), let me know and I'll add the code.