monfort monfort - 1 year ago 128
C# Question

How to define a URL in C#

I have something like this

WebRequest request = WebRequest.Create("");

and I want to use something similar to

#define URL @"""
WebRequest request = WebRequest.Create(URL);

How can I do this in C#?

Answer Source

In C#, you use const to declare a constant, as opposed to a #define, like in C.

const string URL = @"";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download