T.C.
T.C.

Reputation: 279

Why am I allowed to use New on a class with no accessible New method?

According to Object Browser, the PISDKCommon.NamedValues class has no accessible New method. https://i.sstatic.net/xa748.png

However, Visual Studio allows me to use "New PISDKCommon.NamedValues" with no error or warning. https://i.sstatic.net/kxzF4.png

What does this mean?

Edit: The comments and answers I'm getting essentially amount to "The class does have an accessible New method". I am going to remain skeptical of this answer until someone can explain to me why a class with an accessible New method doesn't show that method in the Object Browser.

Upvotes: 0

Views: 107

Answers (1)

dbasnett
dbasnett

Reputation: 11773

From Passing Data to a Constructor

"The constructor method is called New in Visual Basic .NET. By default, Visual Basic .NET creates this New method for you without you having to do anything. You won't see this code within your code module, but it is there implicitly. If you wish to pass some data to this New method, you need to explicitly create it."

Upvotes: 2

Related Questions