K
KevinG
Hi,
I am new to .NET and the .NET CF but have started to play with it
lately. One thing that has puzzled me is the amount of casting going
on in the MSDN samples, for example in the code on the HTTPWebRequest
help page we have:
VB
....
Dim myHttpWebRequest1 As HttpWebRequest =
CType(WebRequest.Create(myUri), HttpWebRequest)
....
and C#
....
HttpWebRequest myHttpWebRequest1=(HttpWebRequest)
WebRequest.Create(myUri);
....
Are the above casts really necessary? I would have thought they were
not. They tend to make the code look very ungainly, especially in VB!
The code compiles fine without them. I would like to leave them out
but I am worried they might be require for some strange reason!
Thanks for reading,
Kevin.
I am new to .NET and the .NET CF but have started to play with it
lately. One thing that has puzzled me is the amount of casting going
on in the MSDN samples, for example in the code on the HTTPWebRequest
help page we have:
VB
....
Dim myHttpWebRequest1 As HttpWebRequest =
CType(WebRequest.Create(myUri), HttpWebRequest)
....
and C#
....
HttpWebRequest myHttpWebRequest1=(HttpWebRequest)
WebRequest.Create(myUri);
....
Are the above casts really necessary? I would have thought they were
not. They tend to make the code look very ungainly, especially in VB!
The code compiles fine without them. I would like to leave them out
but I am worried they might be require for some strange reason!
Thanks for reading,
Kevin.