How can I create a constructor on a class that requires 2 parameters but defaults the second parameter if it isn't specified

I have a class that requires 2 parameters when the class is instantiated.  The way I have the constructors set up is if no parameters are passed, the parameters are defaulted and the constructor that takes 2 parameters is called.  What I want to be able to do is to have the second parameter be defaulted if it isn't specified but I haven't been able to figure out the syntax for it.  Here is what I have so far:

     public partial class DetermineEnvironment
        private HttpContextBase _httpContext = null;
        private ILoadServerList _LoadServerEnvironments = null;
        private List<ServerEnvironmentData> ServerEnvironmentList { get; set; }

       public DetermineEnvironment() : this(new LoadServerEnvironments(), new HttpContextWrapper(System.Web.HttpContext.Current)) { }
        public DetermineEnvironment(ILoadServerList lsl, HttpContextBase hcb)
            // Throw error if HttpContext is null)
            if (hcb == null)
                throw new ArgumentNullException("HttpContext", "HttpContext is not defined");

            // Throw error if HttpContext.Request is null)
            if (hcb.Request == null)
                throw new ArgumentNullException("HttpContext", "HttpContext.Request is not defined");

            // Throw error if LoadServerEnvironments is null
            if (lsl == null)
                throw new ArgumentNullException("ILoadServerList", "LoadServerEnvironments is not defined");

            _httpContext = hcb;
            _LoadServerEnvironments = lsl;

            ServerEnvironmentList = SetServerEnvironmentData();

Open in new window

I tried the following:
        public DetermineEnvironment(ILoadServerList lsl) : this(ILoadServerList lsl, new HttpContextWrapper(System.Web.HttpContext.Current)) { }

but get an error on the lsl shown in bold.  The error is ) expected.

Is there a way to do what I want?  I don't want to have to pass in the HttpContext in production but need to for Unit Testing.  Any help is greatly appreciated!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

anarki_jimbelSenior DeveloperCommented:

public DetermineEnvironment(ILoadServerList lsl) : this(lsl, new HttpContextWrapper(System.Web.HttpContext.Current)) { }

I.e., remove the 'ILoadServerList ' type indication from "this" call.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dyaroshAuthor Commented:
I tried everything but that.  Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.