473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Error with "internal interface"

I am facing a problem. My project is composed of several assemblies. In one
of them -the backend- I have several internal classes that must implement an
interface. These internal classes are only used by one master class that is
public.

I am able to declare the interface as "internal interface" without problem
but when I attempt to use it by declaring a class that implements it, if I
declare the implemented interface members as "internal" (they are supposed
to be seen only within the assemly) I get an error that it is not
implemented because of "wrong return type or wrong visibility" so basically
it is forcing me to use "public" which I don't want because I don't want
those methods to be seen outside.

Or... perhaps the public gets "downgraded" if you use an "internal"
attribute in the class declaration, at least that is what I am hoping for
but makes the notation a bit confusing.

Emilio
Jun 14 '07 #1
4 2376
On Jun 14, 1:39 pm, "~~~ .NET Ed ~~~" <tiredofs...@abolishspam.now>
wrote:
I am facing a problem. My project is composed of several assemblies. In one
of them -the backend- I have several internal classes that must implement an
interface. These internal classes are only used by one master class that is
public.

I am able to declare the interface as "internal interface" without problem
but when I attempt to use it by declaring a class that implements it, if I
declare the implemented interface members as "internal" (they are supposed
to be seen only within the assemly) I get an error that it is not
implemented because of "wrong return type or wrong visibility" so basically
it is forcing me to use "public" which I don't want because I don't want
those methods to be seen outside.
That's because all interface members are public by default.
Or... perhaps the public gets "downgraded" if you use an "internal"
attribute in the class declaration, at least that is what I am hoping for
but makes the notation a bit confusing.
Nope, the members are still public.

However, if the class itself is internal, that's pretty much
irrelevant as no-one outside the assembly will be able to see it
anyway.

Jon

Jun 14 '07 #2
Hi,

If those classes are only used by one class, why don't you declare them as
private to the master class?

/In the same vein you can declare your interface inside the Master class.
But even so it might be visible from the outside using Master.Interface

Now, if you change the interface for an abstract class inside the Master you
can get what you want:
public class Master
{
abstract class A
{
abstract public void Me();

}
class B : A
{
public override void Me()
{
throw new Exception("The method or operation is not
implemented.");
}
}
}

"~~~ .NET Ed ~~~" <ti*********@abolishspam.nowwrote in message
news:ua**************@TK2MSFTNGP04.phx.gbl...
>I am facing a problem. My project is composed of several assemblies. In one
of them -the backend- I have several internal classes that must implement
an interface. These internal classes are only used by one master class that
is public.

I am able to declare the interface as "internal interface" without problem
but when I attempt to use it by declaring a class that implements it, if I
declare the implemented interface members as "internal" (they are supposed
to be seen only within the assemly) I get an error that it is not
implemented because of "wrong return type or wrong visibility" so
basically it is forcing me to use "public" which I don't want because I
don't want those methods to be seen outside.

Or... perhaps the public gets "downgraded" if you use an "internal"
attribute in the class declaration, at least that is what I am hoping for
but makes the notation a bit confusing.

Emilio

Jun 14 '07 #3
"~~~ .NET Ed ~~~" <ti*********@abolishspam.nowschrieb im Newsbeitrag
news:ua**************@TK2MSFTNGP04.phx.gbl...
I am able to declare the interface as "internal interface" without problem
but when I attempt to use it by declaring a class that implements it, if I
declare the implemented interface members as "internal" (they are supposed
to be seen only within the assemly) I get an error that it is not
implemented because of "wrong return type or wrong visibility" so
basically it is forcing me to use "public" which I don't want because I
don't want those methods to be seen outside.
If you want the methods to remain internal you have to implement them
explicitly, that is by naming the interface in the member:

public class Class : Interface
{
//This member is only accessible by cast to the interface
void Interface.Method()
{
//This call is made if the following declaration is present
Method();
//Or simpöy put here the implementation
}

//Make it accessible without cast to interface
internal void Method()
{
...
}
}

Now you have a public class wich implements a interface, wich is only
accessible internal.

But if the class itself is internal, all members even public will only be
accessible internal.

Christof
Jun 14 '07 #4
>I am able to declare the interface as "internal interface" without
>problem
but when I attempt to use it by declaring a class that implements it, if
I
declare the implemented interface members as "internal" (they are
supposed
to be seen only within the assemly) I get an error that it is not
implemented because of "wrong return type or wrong visibility" so
basically
it is forcing me to use "public" which I don't want because I don't want
those methods to be seen outside.

That's because all interface members are public by default.
>Or... perhaps the public gets "downgraded" if you use an "internal"
attribute in the class declaration, at least that is what I am hoping for
but makes the notation a bit confusing.

Nope, the members are still public.

Didn't we just discuss this exact issue to death earlier this week?

http://groups.google.com/group/micro...56d1646a1e150b

Jun 15 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Sam | last post by:
Guys facing a strange problem any clue would really rescue me.. i am using a ASP application with following things Server : Intel Xeon (TM) CPU 2GHz, 2GB RAM, 136GB HDD OS : Windows 2000...
7
by: Will Hartung | last post by:
I have this: <a class="pink_link" href="faq.html#q1">Go to question 1</a> And the CSS is simply: ..pink_link {color: #fa61b7; font-weight: bold;} So, I'm curious why my links are blue and...
5
by: BoonHead, The Lost Philosopher | last post by:
Does anyone know how to implement internal interface documentation for functions and parameters? I found a similair thing for proerties. For properties I found something like:...
12
by: relaxedrob | last post by:
Hi All! I have a page with with the following style information: <link rel="stylesheet" type="text/css" href="/eEmployment/eTech.css" /> <style type="text/css"> DIV.Application {...
1
by: n_o_s_p_a__m | last post by:
My web service has a webmethod whose return type is declared as an interface type, for example: public IBusinessProcess GetBusinessProcess() {} which generates the lovely error: Cannot...
2
by: Peter Rilling | last post by:
I have some COM+ components that seem to be throwing some exceptions. However, IIS to just displays the "insernal server error" message. How can I get the actual error to display?
2
by: Gnus | last post by:
Hi all! I have a little(?) problem with external schema location... I'm using xerces/xalan (C++) for doing some actions with some set of xml-files. Some of these files must validating...
23
by: ticfranca | last post by:
Hi, I'm getting this error in the code below: sub Pega_recorde { $database = 'bundinha'; $host = 'localhost'; $usuario = 'myhumoradm'; $senha = 'my8xr2d2'; ...
0
by: Peter | last post by:
Hi I'm stuck and would appreciate some help. I have created a Class library project that contains a number of interface definitions that must be used by a range of other VB.NET applications. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.