- a NameOf operator
you could use this similar to TypeOf, but to get the name of a class or a method or property etc.
NameOf could be used :
- without any operand to return the name of the current method/property, e.g NameOf()
- using an object reference ot get a typename, e.g NameOf(Me) gives the name of the current class
- get the name of the current class in a Shared method by using the Class keyword, NameOf(Class)
- get the name of a method as a string, NameOf(Foo.Bar) returns “Bar”. Although this last case doesn’t seem important, it does allow for compiler verification
Public Property Text As String
Set(ByVal value as String)
- Shared Class’es
Although a Module is basically a Shared Class, I would like to be able to use Shared Class instead and in particular would like to be able to stop the implied importing of the Module namespace that currently occurs.
- Extension methods in classes
This would be handy to provide methods that are Shared in nature, while allowing for member evaluation. For example, let’s say you have a Class Foo and it has a Count property. If you were to write obj.FooProperty.Count you could get a null reference exception if obj.FooProperty is Nothing. If however Count was an extension method, you could decide to return -1 if FooProperty was Nothing.
- Properties as Extension members
I saw this posted by a fellow MVP the other day, and think it would be a nice addition. Just as you can have extension methods, have extension properties.