Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

A better class definition

$
0
0
Hi,

I am new to VB.NEt and am creating a program where I have defined a generic class as follows:

VB Code:
  1. Class MyDataBase(of T)
  2. Implements IEnumerable(Of  StampedVersion)
  3.  
  4. public Class StampedVersion
  5. dim OriginalItem as T
  6. dim StampNo as integer
  7. end class
  8.  
  9. dim ListOfItems as List(of  StampedVersion)
  10. 'other procedures
  11.  
  12. 'implementation of enumerators
  13. end class
I have several types of objects, and each needs a database of its own given above, along with a stamped version of the type, exposed to the outside world by the class MyDataBase(of T).StampedVersion

Now I need to define the iterating variable (in a for each loop) as
Dim CurStampedItem as MyDataBase(of T).StampedVersion

This works fine. But I wish to know if I could define the above in a more elegant fashion
Dim CurStampedItem as StampedVer(of T)

instead of defining it as a contained class of the generic class. Any ideas on how to do this? Thanks.

Shankar

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>