|
-
Jul 2nd, 2007, 03:44 PM
#1
Thread Starter
Registered User
[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.
-
Jul 2nd, 2007, 05:48 PM
#2
Addicted Member
Re: [2.0] Class instantiation shortcut
 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
-
Jul 2nd, 2007, 06:52 PM
#3
Re: [2.0] Class instantiation shortcut
 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.
-
Jul 2nd, 2007, 07:00 PM
#4
Thread Starter
Registered User
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|