_Andy_ <
[email protected]> scripsit:
I geuss this should be easy to answer, but is there a VB.Net
version of [the C instruction] 'typedef'? The manual doesn't give any
clues..
Where is no equivalent to 'typedef' in VB.NET. Why exactly do you want
to use it?
e.g.
-example start-
Class SomeClass
Sub New(oName As Forename)
End Sub
Sub New(oName As Surname)
End Sub
End Class
-example end-
Ideally, both Forename & Surname would be implemented as classes. To
save time, OO is abandoned and a String class is used instead. This
doesn't help overloading. So, typedef'ing a Forename as a String, and
a Surname as a String would be useful in the interim. I had suspected
that it was not possible. Bit if a shame.
Rgds,
While not exactly equivalent, it is possible to use the imports
statement to create an alias for a type. The limitation really is that
it only applies to the file that it is in. There is no way to do an
include really. But, anyway - here is an example. At the top of your
file:
Option Strict On
Option Explicit On
Imports System
Imports Surname = System.String
Imports Forename = System.String
This of course will still not help you in your example class - since the
type is still System.String you will get an error because of the
duplicate definition.
Tom Shelton