Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27350

Why do some.NET classes use specialized initialization methods and not the New KW?

$
0
0
Hi everyone, basic question that could use someone to enlighten me on...

I noticed that the Net.HttpWebRequest class is not initialized using the New Keyword, instead you need to call a shared method, Create.

Code:

Dim req As Net.HttpWebRequest = Net.HttpWebRequest.Create("http://example.com")
Why is this? Why didn't they just create an overloaded New sub? I think it makes it more confusing, but I am sure there is a reason this and many other classes do it this way...:confused:

Viewing all articles
Browse latest Browse all 27350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>