O
ozbear
In C# is there a way to alias or equivalence one type to another?
For example, in Delphi, I can say...
type TMyFloat = type double;
and then cheerfully use TMyFloat in my field definitions, return
value declarations for functions, declaring variables and formal
procedure/function/method arguments. If at a later time -double-
turns out to be a suboptimal choice I can change the lone type
declaration to say....
type TMyFloat = type Extended;
and recompile without having to change all of the declarations
elsewhere in my application.
I could subclass non-sealed classes to achieve something like this
but for C#'s sealed supplied classes, like changing my mind to
use Decimal instead of double, I can't think of a way.
Any ideas?
Oz
For example, in Delphi, I can say...
type TMyFloat = type double;
and then cheerfully use TMyFloat in my field definitions, return
value declarations for functions, declaring variables and formal
procedure/function/method arguments. If at a later time -double-
turns out to be a suboptimal choice I can change the lone type
declaration to say....
type TMyFloat = type Extended;
and recompile without having to change all of the declarations
elsewhere in my application.
I could subclass non-sealed classes to achieve something like this
but for C#'s sealed supplied classes, like changing my mind to
use Decimal instead of double, I can't think of a way.
Any ideas?
Oz