Mike Smith

Mike Smith

  • NA
  • 6
  • 0

User-defined variable types

Oct 24 2010 7:21 AM
A useful construct in Delphi (Object Pascal) is:

type
  TNumColors = 1..256;
var
  numColors: TNumColors;

This defines numColors to a restricted range of integers and allows range checking.

How do you do this in C# please?


Answers (6)