You can cast using as
; this will not throw any exception, but return null
if the cast is not possible (just like TryCast
):
HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;
You can cast using as
; this will not throw any exception, but return null
if the cast is not possible (just like TryCast
):
HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest;