How can I create two contructors that act differently but recieve the same data type?
- by Sergio Tapia
public class Parser
{
Downloader download = new Downloader();
HtmlDocument Page;
public Parser(string MovieTitle)
{
Page = download.FindMovie(MovieTitle);
}
public Parser(string ActorName)
{
Page = download.FindActor(ActorName);
}
}
I want to create a constructor that will allow other developers who use this library to easily create a Parser object with the relevant HtmlDocument already loaded as soon as it's done creating it.
The problem lies in that a constructor cannot exist twice with the same type of parameters. Sure I can tell the logical difference between the two paramters, but the computer can't.
Any suggestions on how to handle this?
Thank you!