Delphi's subrange types in C#?
In Delphi (or any Pascal) you can declare sub-range type so if you try
assign value from outside allowed range, you would get compiler error.
var
i: 1..8;
begin
i := 8; // i := 9 would not work
Can this be done in C#? I can imagine creating custom struct, something
like SubrangeType<1, 8> but I'm looking for something builtin.
No comments:
Post a Comment