I am coding a VB.NET application that deals with a collection type. See code below:
Dim sub_Collection As System.Collections.Generic.Dictionary(Of String, System.Collections.ObjectModel.Collection)
I have to type the above line so many times. If I changed the type of collection, I have to make changes for all instances. Therefore, if there is a way to use the "equivalent of typedef", I can get rid of all these problems. I tried with import, but it is intended only for namespaces and cannot be used for classes. Any help would be greatly appreciated.
Note. I am using VB 2008, Windows XP. An application type is a window form (VB).
EDIT: I made several attempts based on code_gray below the answer.
This is the first attempt.
Imports dictionary_WaterBill = System.Collections.Generic.Dictionary(Of String, System.Collections.ObjectModel.Collection(Of WaterBill)) Structure WaterBill ... ... End Structure
I got an error like
Error:Type 'WaterBill' is not defined.
This is an attempt 2.
Structure WaterBill ... ... End Structure Imports dictionary_WaterBill = System.Collections.Generic.Dictionary(Of String, System.Collections.ObjectModel.Collection(Of WaterBill))
I got an error like
Error:'Imports' statements must precede any declarations.
No one can shed light on this problem.
prabhakaran
source share