我是新来C#
的号码,我需要添加一个方法来已经是相当不错编译的程序的帮助。方法获取文件的路径和文件内它
我有以下代码:
class Program
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
static void Main(string[] args)
{
var startTimeOfApplication = DateTime.Now;
Helper.SetFileAppenderLogFile();
Console.WriteLine("Started executing the MPL File processor at :: " + startTimeOfApplication);
log.Info("Started exection at :: " + DateTime.Now);
var filesPath = string.Empty;
if (args.Length > 0)
{
filesPath = args[0];
}
else
{
filesPath = ConfigurationManager.AppSettings["mplFilesPath"].ToString();
}
log.Info("MPL Files Path " + filesPath);
var mplFilesProcessor = new MPLFilesProcessor();
mplFilesProcessor.ProcessMPLFiles(filesPath);
var endTimeOfApplication = DateTime.Now;
Console.WriteLine("Completed MPL Files Processor exection at :: " + endTimeOfApplication);
log.Info("Completed MPL Files Processor exection at :: " + endTimeOfApplication);
log.Info(string.Format("Total time taken to process is {0} minutes ", endTimeOfApplication.Subtract(startTimeOfApplication).TotalMinutes));
}
我必须保存到String
变量目录的路径,我想那路径和计数的文件数量内的。
请帮助我应该如何去写那个方法?
感谢帮助!
[从文件夹中的文件数]的可能的复制(http://stackoverflow.com/questions/2242564/file-count-from-a-folder) –
你尝试过什么? – ItamarG3
没有代码,你的问题已经很清楚了。考虑将它完全从问题中删除,因为它很混乱。 –