I've been coding in VB for quite awhile and I can do plenty in C# and F# as well, but one syntax difference between VB and C# continues to throw me off. I'd Google this, but I'm not sure what to call it exactly. Consider the following examples:
In visual basic I would do this:
Dim Request As HttpWebRequest = HttpWebRequest.Create("www.google.com")
However, when I make what seems to be the "logical" conversion to C#:
HttpWebRequest Request = HttpWebRequest.Create("www.google.com");
I get the implicit type conversion error. After looking at some other code I realized this seems to be the proper way to do this:
HttpWebRequest Request = (HttpWebRequest)HttpWebRequest.Create("www.google.com");
But I'm not exactly clear on what purpose the additional mention of the HttpWebRequest type in the parenthesis accomplishes. Is this some sort of casting syntax I didn't know about? What's going on here that makes this work, and the direct conversion not?