typedef in C# December 21, 2009 at 5:03 pm
While the using directive can be used to create an alias for a type which appears to be a pretty cool replacement for typedef, this article brings out some interesting and important differences.
Mainly, the need to define the alias in every page and the lack of a single header
definitions file.
Because of that limitation this idea can result in inconsistencies and
defeats the code-once use-many rule. In other words, be cautious when
“using” thing’s it wasn’t designed for
.
E.G.
#Page1
using apiStatus = System.Int16;
#Page2
using pooStatus = System.Int16;//inconsistency
#Page3
using apiStatus = System.Int16;
#Page4
apiStatus myStatus = 0;//ERROR, no using statement on this page…code-once use-many
Leave a Reply