Whidbey hopes, dreams, and questions

First I want to say that I think the work that the Microsoft guys have done on the .NET Framework, Visual Studio, and the associated .NET languages is fantastic. Kudos to you!

That said, here are some comments on Visual Basic .NET that possibly could be fixed or looked at for Whidbey.

1) Inheriting from the CollectionForm does not work.

According to this KB Article I should be able to inherit from CollectionEditor.CollectionForm.  However, when I try to
inherit from the class, I get an error: NodeCollectionEditor.vb(50): 'System.ComponentModel.Design.CollectionEditor.CollectionForm' is not accessible in this context because it is 'Protected'.

Apparently, you can inherit from a CollectionForm in C#. I can work around this problem in my ServerControls library by developing the CollectionForm in a separate (C#) project.  But this should work in VB.

2) Simplify the TypeOf syntax.

In C# if I want to know if an object is of a certain type, I can write

if (object is MyClass)

In VB .NET, I have to include the typeof keyword:

If Typeof Object Is MyClass Then

Here's my opinion of what the ideal scenario is:

Given “If A is B Then“, where “A” is always an instance of an objects

When B is a Type or Interface, “If A is B Then” equates to If TypeOf a is b

When B is an instance of an object, If “If A is B Then” equates to If A is this particular instance of B.

UPDATE


3) The ability to declare common variables to Get/Set routines in Properties

Example:

Public Property MyValue() As String

const lookupstr as string = "MyValue"

Get

Me.ViewState(lookupstr)

End Get

Set(ByVal Value As String)

Me.ViewState(lookupstr) = Value

End Set

End Property

In this example, I have saved myself the the possibilty of mis-typing “MyValue“ in the Getter and Setter, which granted probably wouldn't be a problem here.  But there are many properties that have difficult-to-type names, and more than once I've been bitten because I'm reading from one ViewState variable, and writing to another. 

2) qualifies as more a suggestion I guess, but 1) seems to be a bug.

Comments?

Comments

# re: Whidbey hopes, dreams, and questions

Friday, February 27, 2004 2:26 PM by Sergio Pereira

I also dislike the TypeOf in VB.
I wish it was
If obj TypeOf MyClass Then
or
If obj IsTypeOf MyClass Then

Much more natural and easier to remember IMHO.

# re: Whidbey hopes, dreams, and questions

Friday, February 27, 2004 2:32 PM by Chris McKenzie

Agreed, especially your example 2. "If obj IsTypeOf MyClass Then" is very fluid, and is written the way we think it.

# Take Outs: The Digital Doggy Bag of Blog Bits for 27 February 2004

Friday, February 27, 2004 6:17 PM by TrackBack

Take Outs: The Digital Doggy Bag of Blog Bits for 27 February 2004

# Language enhancements I'd like to see.

Tuesday, May 31, 2005 4:08 PM by TrackBack

Leave a Comment

(required) 
(required) 
(optional)
(required)