2014-09-02 1 views
0

"IClient"인터페이스를 구현하는 "namespace MS.Client"와 "namespace MS"중 하나에서 "public partial class CustomerDetail"과 같은 이름을 가진 두 개의 클래스가있는 두 개의 네임 스페이스가 있습니다. .Customer "는"ICustomerInfo "인터페이스를 다른 어셈블리에서도 구현합니다. 다른 "네임 스페이스 MS.Applications.View" "네임 스페이스 MS.Client"에 대한 참조가 있지만 "CustomerDetail"클래스를 "네임 스페이스 MS.Applications.View"에서 인스턴스화한다고 가정 할 때 "CustomerDetail"에 액세스하려고합니다. 모든 네임 스페이스의 "CustomerDetail"에 속한 모든 속성이 올바른 것입니까? 하지만 실제로는 작동하지 않았습니다. 어느 누구도이 일에서 나를 도울 수 있습니까? 인터페이스가있는 부분 클래스

namespace MS.Customer 
{ 
    public partial class CustomerDetail : ICustomerInfo 
    { 
     private string name; 

     public string Name 
     { 
      get { return name; } 
      set { name = value; } 
     } 

     private string address; 

     public string Address 
     { 
      get { return address; } 
      set { address = value; } 
     } 

    } 
} 


namespace MS.Client 
{ 
    public partial class CustomerDetail : IClient 
    { 
     private string name; 

     public string CustName 
     { 
      get { return name; } 
      set { name = value; } 
     } 

     private string address; 

     public string CustAddress 
     { 
      get { return address; } 
      set { address = value; } 
     } 


    } 
} 
중 하나가 내 요약을 이해하지 못할 경우 알려 주시기 바랍니다.

답변

0

아니요, 클래스는 해당 네임 스페이스에 로컬이므로 다른 네임 스페이스에서 클래스를 수정할 수 없습니다. 모든 클래스는 실제 이름 인 정규화 된 이름을 가지며 네임 스페이스는이 이름의 일부입니다.

코드에서 실제로 수행하는 작업은 MS.Customer.CustomerDetailMS.Client.CustomerDetail 인 두 개의 다른 CustomerDetail 클래스를 서로 다른 네임 스페이스에 정의하는 것입니다.

당신이 시도하고있는 것을 달성하기 위해 네임 스페이스 중 하나를 변경하여 실제로 일치하도록하고 CustomerDetail이 실제로 동일해야합니다 (예 : 동일한 접두사가 붙어 있기 때문에 정규화 된 동일한 이름을 가짐). 네임 스페이스가 있고 같은 이름을 가짐).

+0

나중에 볼 수 있습니다. 감사 :) – user1853127