Reputation: 8977
I imagined it would look something like:
public MyFileClass(FileInfo info)
{
//do things
}
public MyFileClass (string url, string Description)
{
// var tempfile = FileInfo that results from creating file
MyFileClass(tempfile)
}
What is the proper way to implement this idea? I've got the file creation part down, just not quite sure of the syntax for making it work in this way.
Upvotes: 1
Views: 48
Reputation: 1833
You could implement a static method to create the FileInfo.
public class MyFileClass
{
public MyFileClass(FileInfo info)
{
// do work
}
public MyFileClass(string url, string description)
: this(GetFileInfo(url, description))
{
// do more work
}
static FileInfo GetFileInfo(string url, string description)
{
return new FileInfo();
}
}
Upvotes: 3