1

This is at least a documentation error, if not a bug.

In VB.NET prior to .NET 4.0 (i.e. VB.NET 7 through 9) an empty Structure declaration fails at compile-time with

error BC30281: Structure 'MySimpleEmpty' must contain at least one instance member variable or Event declaration.

E.g. The following two structures compile successfully in VB10, and not prior:

Structure MySimpleEmpty
End Structure

Public Structure AnotherEmpty
  Public Const StillEmpty As Boolean = True
End Structure

I note the documentation for the Error BC30281 stops at VB9, but the documentation for the Structure statement still has the datamemberdeclarations as required even as of VB11 (.NET 4.5 VS2012).

These two Structures compile in VB11 (VS2012) as well. (Thanks John Woo.)

Is there some blog entry or documentation confirming this is an intended change or a bug in VB10 and later?

4

1 回答 1

0

Microsoft 已将此标记为已修复的错误,但并未实际说明已修复的内容。

VB11 (VS2012) 文档现在说datamemberdeclarations在语法中是可选的,但在 Parts 表中它说“必需。零个或多个......”!

我想这是一个修复...... VB10(VS2010)文档没有改变。

于 2013-06-29T17:45:04.357 回答