A
aine_canby
Ms defines get as follows: an accessor method in a property or indexer
that retrieves the value of the property or the indexer element.
So is the following TestDirectory get bad practice?
class Framework
{
string directory;
static string testFolder = "Test";
public static string TestFolder { get { return testFolder; }}
public static string TestDirectory{ get { return directory
+@"\"+testFolder; }}
public Framework(string directory)
{
this.directory = directory;
}
}
should I do this instead:
public static string GetTestDirectory()
{
return directory+@"\"+testFolder;
}
Thanks,
Aine
that retrieves the value of the property or the indexer element.
So is the following TestDirectory get bad practice?
class Framework
{
string directory;
static string testFolder = "Test";
public static string TestFolder { get { return testFolder; }}
public static string TestDirectory{ get { return directory
+@"\"+testFolder; }}
public Framework(string directory)
{
this.directory = directory;
}
}
should I do this instead:
public static string GetTestDirectory()
{
return directory+@"\"+testFolder;
}
Thanks,
Aine