I tried to search a bit before asking but I really had no idea what to search for on this one so here’s what I’m looking for:
I need a way to declare an object in VB.net so that I can set it to the current class(using the class as the object type) but if the class name changes then the object type changes to match the new class name. Here’s an example.
Class UhhWhat
Dim L As List(Of UhhWhat)
Sub add()
L.Add(Me)End Sub
End Class
So if this were my code and someone copied it to a new class with a different name say… “UhhNo” then I would want the “List(Of UhhWhat)” to change to “List(Of UhhNo)”.
Does that make sense? I’m not really stuck on having the name for the object type, I just want something that will function like the List object’s Of T but use the current class’ type rather than a type supplied to a subroutine.
I would like this done when the code is written, not at runtime because I need intellisense to continue to function for the new type.
Lastly, I do know that simply using “List(Of Object)” would help my problem.. however this will not work for intellisense and I have heard that declaring an object as “object” type is slower than if you declared it as a specific type.
To sum it up what I’m looking for is a way to change the object type to whatever the programmer changes the class name to, automatically.
Thx a bunch 🙂
–EDIT–
I found the solution I was looking for in a rather simple place.. the VS rename function.. ahh another time when the answer was so simple.
Kudos to David W for their patience with me, thx a bunch David W!
I hope i didn’t bug ya too much with my vague ideas 🙂
I appreciate the suggestions 🙂
In Solution Explorer, when you rename a class file, Visual Studio will fix the corresponding class names accordingly.