[RESOLVED] [2.0] Class instantiation shortcut
Hi all,
For example:
vb.net Code:
Dim wc As New System.Net.WebClient()
Dim wc As Net.WebClient = New System.Net.WebClient()
As the first line above is a shortcut for the second, is there an equivalent in C# for this or is this the only option?
c# Code:
System.Net.WebClient wc = new System.Net.WebClient();
Thanks.
Re: [2.0] Class instantiation shortcut
Quote:
Originally Posted by nmadd
Hi all,
For example:
vb.net Code:
Dim wc As New System.Net.WebClient()
Dim wc As Net.WebClient = New System.Net.WebClient()
As the first line above is a shortcut for the second, is there an equivalent in C# for this or is this the only option?
c# Code:
System.Net.WebClient wc = new System.Net.WebClient();
Thanks.
You could add 'using System.Net;' to the top of your page...
Code:
using System.Net;
...
WebClient wc = new WebClient();
but unsure of any other way....
Cheers, Justin
Re: [2.0] Class instantiation shortcut
Quote:
Originally Posted by nmadd
Hi all,
For example:
vb.net Code:
Dim wc As New System.Net.WebClient()
Dim wc As Net.WebClient = New System.Net.WebClient()
As the first line above is a shortcut for the second, is there an equivalent in C# for this or is this the only option?
c# Code:
System.Net.WebClient wc = new System.Net.WebClient();
Thanks.
As far as I'm concerned, No.
Re: [2.0] Class instantiation shortcut
Thanks effekt, but it could've been any class. Was just looking for the shortened code. :)
Thanks mar: I didn't think there was since the code converter I use spit out the same line regardless of what line of VB I pumped in.