I'm wondering if someone has seen this scenario before or has any suggestions to what might be causing it. I have a custom class called Dashboard
that exists inside a project called Dashboard.Data.Client
. Within that same project, if I try to reference the class's namespace such as:
using Alliance.Dashboard.Data.Client.Models;
then I cannot use the type Dashboard
. However, anywhere I need to use Dashboard
, I can type out the fully qualified name and it works fine. Example:
Alliance.Dashboard.Data.Client.Models.Dashboard myDashboard = new Alliance.Dashboard.Data.Client.Models.Dashboard();
A few notes I'm sure you will be wondering:
If I just type Dashboard
in a class, and then try to resolve it, the option isn't available.
I have seen this issue before if there are conflicting namespaces. In such case, a fully qualified name must be given. That is not the case here. There is no conflicting namespaces.
Other classes resolve just fine within this project. As a matter of fact, here is a scenario: from IDashboardRepository
this problem exists trying to declare Dashboard
just as I described. IDashboardRepository
is in the same project but in a different namespace: Alliance.Dashboard.Data.Client.Interfaces
. However, the reverse works fine. In other words, I can use the interface namespace as a using statement within Dashboard
, but not Dashboard
inside the interface without the fully qualified name.
For reference, here is the code for my Dashboard
class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Alliance.Dashboard.Data.Client.Models
{
public class Dashboard
{
public System.Guid DashboardID { get; set; }
public string DashboardName { get; set; }
public byte[] Instance { get; set; }
public bool IsDeleted { get; set; }
public byte[] Concurrency { get; set; }
}
}
Well, I feel pretty stupid on this one. Simply put, the namespace and class name are the same. The compiler thinks that I have entered the beginning of the namespace directory instead of the class name. Thanks again for taking time to help another knuckle head.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.