Link to home
Start Free TrialLog in
Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya

asked on

The type or namespace name 'xxx could not be found

Hello Experts,
I am trying to create a Windows Service project, which uploads data from an API.  In one class, I am trying to access an external class name ManageData, with in the same project.  But, getting the below error message.  Please see the attached picture.  Please let me know how to fix it.  Thank you in advance.

Error      CS0246:      The type or namespace name 'ManageData' could not be found (are you missing a using directive or an assembly reference?)

Thank you!
Service.png
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi RadhaKrishnaKiJaya;

The class in the posted image is declared as private. It must be changed so that it can be Accessed from outside that class. See below
From Microsoft documentation Access Modifiers (C# Programming Guide)
All types and type members have an accessibility level, which controls whether they can be used from other code in your assembly or other assemblies. You can use the following access modifiers to specify the accessibility of a type or member when you declare it:

public
The type or member can be accessed by any other code in the same assembly or another assembly that references it.

private
The type or member can be accessed only by code in the same class or struct.

protected
The type or member can be accessed only by code in the same class, or in a class that is derived from that class.

internal
The type or member can be accessed by any code in the same assembly, but not from another assembly.

protected internal
The type or member can be accessed by any code in the assembly in which it is declared, or from within a derived class in another assembly.

private protected
The type or member can be accessed only within its declaring assembly, by code in the same class or in a type that is derived from that class.
Avatar of RadhaKrishnaKiJaya
RadhaKrishnaKiJaya

ASKER

Hello Fernando,
Thank you for your help.  I tried all other declaration types.  None of them works.  Here I am trying to access ManageData, which is external.  I am not sure how the declaration type matters here.  Still I tried all in your list.

Thank you!
ASKER CERTIFIED SOLUTION
Avatar of it_saige
it_saige
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you Saige.  That is was missing.  It worked now.  Thank you again.