在以下方法中,從DATE和toDate值的參數從不使用,因爲它們在被讀取之前會在主體中被覆蓋。Resharper建議但不對此代碼塊執行任何重構
static void GetDatesFromMonth(string month, ref DateTime fromDate, ref DateTime toDate)
{
DateTime userDateTime = TimeHelper.getUserGMTNow();
DateTime calculatedDate = Convert.ToDateTime(month + " 01," + userDateTime.Year);
toDate = calculatedDate.AddMonths(1).AddSeconds(-1);
fromDate = toDate.AddMonths(-12).AddSeconds(1);
}
我在我的類文件中的許多地方使用此代碼。
當我在我的代碼運行ReSharper的它顯示了此消息,並與它的所有其他suggessions它是不能夠糾正這種代碼塊
任何人可以幫助我重寫此方法具有良好的編碼習慣。
**問ReSharper的錯誤\警告太多** – gdoron 2012-03-18 10:20:32