Is it possible to create an alias to existing types and use that alias through out the project?
For example, create
CustomerID = System.UInt32
and use CustomerID as a datatype?
Version : .NET Framework 4.0
(With the “using” keyword we would be able to create an alias, but it is not useful as it does not work across files.)
Any other ideas?
I believe the correct answer to this question is:
No, that’s (unfortunately?) not possible. 🙁
Edit 1: However, you can (kind of) simulate this by making your own
struct, and providing implicit conversions to/from the type you want. It’s not exactly magical but it might work, depending on the situation.Edit 2: I haven’t ever used this feature before, but type forwarding might be helpful. It only forwards to another entire assembly, though, so it probably won’t work for simple cases.