I have a class which you pass in a folder and then it goes off and processes a lot of data within the specified folder.
For instance:
MyClass myClass = new MyClass(@"C:\temp");
Now it goes off and reads say a couple of thousand files and populates the class with data.
Should I move this data out from the constructor and have it as a separate method, such as the following?
MyClass myClass = new MyClass();
myClass.LoadFromDirectory(@"C:\temp");
Maybe you should try it this way with a static method that returns an instance of the object.
This will keep the initialization code outside of your constructor, as well as giving you that “one line” declaration you are looking for.
Going on the comment from below from the poster, by adding State an implementation could be like so: