tags:

views:

99

answers:

3

How do you convert the following c# code to vb.net?

 private static readonly ICollection<string>
            _skipHeaders
                = new[]
                      {
                          "Connection",
                          "Keep-Alive",
                          "Accept",
                          "Host",
                          "User-Agent",
                          "Content-Length",
                          "Content-Type",
                          "Accept-Encoding",
                          "Authorization",
                          "Referer",                          
                          ProxyMethodHeader,
                          ProxyAuthorizationHeader,
                          ProxyAcceptHeader,
                          ProxyAgentHeader,
                          ProxyQueryHeader
                      };
+1  A: 
Private Shared ReadOnly _skipHeaders As ICollection(Of String) = New () 
{"Connection", "Keep-Alive", "Accept", "Host", "User-Agent", "Content-Length", "Content-Type", "Accept-Encoding", "Authorization", "Referer", ProxyMethodHeader, ProxyAuthorizationHeader, ProxyAcceptHeader, ProxyAgentHeader, ProxyQueryHeader}
Mick Walker
+7  A: 

The following will work for vb9

Private Shared _skipHeaders as ICollection(Of String) = New String() { _
  "Connection", _
  "Keep-Alive", _ 
  ...  }
JaredPar
Thanks, the line continuation characters were the missing link. I got the same output as the first answer from the online code translators.
Congero
+1  A: 

I upvoted JaredPar's answer because its correct. For future reference, there's a great conversion tool @

http://www.developerfusion.com/tools/convert/csharp-to-vb/

NickAtuShip
The code conversion at developerfusion.com is usually good, in this case, it did not include the line continuation characters.
Congero
well - thats true - but only because it did it on one line, so the continuation arent necessary.
NickAtuShip