我有这两个功能如何重载两种方法具有不同的输入参数
private void calcResults()
{
MakePath(id, results, _resultCount);
MakePath(id, "XYZ", _resultSICount)
}
private string MakePath(string subFolder, object obj, int index)
{
string dir = System.IO.Path.Combine(_outputDir, subFolder);
string fileName = string.Format("{0} {1} {2}.xml",
obj.GetType().Name, _dateTimeSource.Now.ToString(DATE_FORMAT), index.ToString());
return System.IO.Path.Combine(dir, fileName);
}
private string MakePath(string subFolder, string tempFileName, int index)
{
string dir = System.IO.Path.Combine(_outputDir, subFolder);
string fileName = string.Format("{0} {1} {2}.xml",
tempFileName, _dateTimeSource.Now.ToString(DATE_FORMAT), index.ToString());
return System.IO.Path.Combine(dir, fileName);
}
可以请一些一个扶。
感谢
你有什么问题/你有问题..? – MethodMan 2013-03-18 14:26:24
在标题中,你讲的是重写*方法,但是没有一个显示的方法是'虚拟'的,所以在这种情况下重写是不可能的。 – 2013-03-18 14:28:52
我需要先避免冗余代码..然后我想使用方法重写来简化代码。请让我知道如果你需要更多的信息 – user175084 2013-03-18 14:31:16