I am new to C# and trying to take what I have learned in PHP / Laravel and transition it over. I am trying to setup a definition list for environmental variables, similar to https://github.com/laravel/laravel/blob/master/.env.example.
I can't figure out how to get the variables to be in scope
for me to use other places.
To get started I created a new file URLlist.cs and have this in there:
namespace WindowsFormsApp1
{
public class URLlist
{
public const string getLinks = "https://www.example.com/api/v1/geturls";
public const string postLinks = "https://www.example.com/api/v1/posturls";
}
}
I was hoping to be able to use something like URLlist.getLinks, URLlist::getLinks, or URLlist=>getLinks. No matter what I have tried, I can't access those variables from within the Main()
scope.
Do I have to define a class for every URL / variable? Seems really repetitive and like something someone would have solved by now, so I thought I would ask.