I am having some namespace issue that is confusing me why it is happening.
In the below code, System.IO & System.Reflection is attempting to reference abc.System instead of using the System namespace I declared at the top. Why is that?
using System;
using System.Collections.Generic;
using System.Data.OleDb;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace abc.Data
{
public sealed class Access
{
public static void Open(string dbPath)
{
// error here referencing abc.System in System.IO, and System.Reflection.
string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); }
}
I then have another namespace in a separate file as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace abc.System
{
public static class DateTimeExtensions
{
// Implemented from
// http://stackoverflow.com/questions/38039/how-can-i-get-the-datetime-for-the-start-of-the-week
public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek)
{
int diff = dt.DayOfWeek - startOfWeek;
if (diff < 0)
{
diff += 7;
}
return dt.AddDays(-1 * diff).Date;
}
public static DateTime EndOfWeek(this DateTime dt, DayOfWeek startOfWeek)
{
int diff = dt.DayOfWeek - startOfWeek;
if (diff < 0)
{
diff += 7;
}
return dt.AddDays(diff).Date;
}
}
}