473,480 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Accessing an Internal Class in Multi-file Assemblies

How can we access an internal class in a referenced file in a multi-file
assembly. All documentation states the obvious purpose of the internal
keyword on a class, but when referencing an assembly, I fear it means
single-file assembly. That means even if the assembly is strong-named and
versioned, it will not reach internal classes. So much for code reuse while
hiding classes from external objects. I can't find examples or explanations
of how to do this.

Here is a layout of the problem:

_______________________________________________
namespace ns1 (with strong name)
Lib1.dll --------------------------------------------------
internal Class1
public Class2

App1.exe ------------------------------------------------
- Problem - references Lib1.dll in this multi-file assembly but can
only reach Class1 if it is public (a bad thing).
_______________________________________________
namespace ns2 (without strong name - any external application)
App2.exe -------------------------------------------------
- No Problem - references Lib1.dll and can access Class2 but as
expected not Class1
Thanks for any response.
-VinceB
Nov 15 '05 #1
2 6966
Joe
"msnews.microsoft.com" <vb********@progressiontech.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
How can we access an internal class in a referenced file in a multi-file
assembly. All documentation states the obvious purpose of the internal
keyword on a class, but when referencing an assembly, I fear it means
single-file assembly. That means even if the assembly is strong-named and
versioned, it will not reach internal classes. So much for code reuse while hiding classes from external objects. I can't find examples or explanations of how to do this.

Here is a layout of the problem:

_______________________________________________
namespace ns1 (with strong name)
Lib1.dll --------------------------------------------------
internal Class1
public Class2

App1.exe ------------------------------------------------
- Problem - references Lib1.dll in this multi-file assembly but can only reach Class1 if it is public (a bad thing).
_______________________________________________
namespace ns2 (without strong name - any external application)
App2.exe -------------------------------------------------
- No Problem - references Lib1.dll and can access Class2 but as
expected not Class1


Hi VinceB,

App1.exe and Lib1.dll are separate assemblies. The strong name isn't a
factor here.

Joe
--
http://www.csharp-station.com
Nov 15 '05 #2
I think that Joe was implying that you have these two files compiled as
different assemblies, causing internal methods from one to not be visible to
the other. You need to compile one as a netmodule ("csc /t:module" from the
command line), and include that when compiling the other ("csc /addmodule
lib.netmodule"), so that they will be in the same assembly.

Suzanne Cook
My .NET CLR Loader blog: http://blogs.gotdotnet.com/suzcook/
--
Please do not respond directly to this alias. This alias is for newsgroup
purposes only. This posting is provided "AS IS" with no warranties, and
confers no rights.
"msnews.microsoft.com" <Vi****@nospammy.com> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
One more clarification please.

This means if I want a secure API DLL to be used by my EXE and unknown and
possibly rogue clients, I either give clients everything or limit my rich
EXE or duplicate code or pass out instances of an interface or something.

I want multiple modules in an app that can be updated automatically from the web but if they can't see each other unless all classes are public, I see
one big DLL.
Thanks.
"Joe" <jo*@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
"msnews.microsoft.com" <vb********@progressiontech.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
How can we access an internal class in a referenced file in a multi-file assembly. All documentation states the obvious purpose of the internal keyword on a class, but when referencing an assembly, I fear it means
single-file assembly. That means even if the assembly is strong-named and versioned, it will not reach internal classes. So much for code reuse

while
hiding classes from external objects. I can't find examples or

explanations
of how to do this.

Here is a layout of the problem:

_______________________________________________
namespace ns1 (with strong name)
Lib1.dll --------------------------------------------------
internal Class1
public Class2

App1.exe ------------------------------------------------
- Problem - references Lib1.dll in this multi-file assembly but
can
only reach Class1 if it is public (a bad thing).
_______________________________________________
namespace ns2 (without strong name - any external application)
App2.exe -------------------------------------------------
- No Problem - references Lib1.dll and can access Class2 but

as expected not Class1


Hi VinceB,

App1.exe and Lib1.dll are separate assemblies. The strong name isn't a
factor here.

Joe
--
http://www.csharp-station.com


Nov 15 '05 #3

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

Similar topics

8
2508
by: Carlos J. Quintero | last post by:
Hi, As you know the current keywords "protected internal" (C#) or "Protected Friend" (VB.Net) means "Protected Or internal" (C#) or "Protected Or Friend" (VB.Net), that is, the member is...
5
18551
by: Trey | last post by:
Is it possible to access the parent from an instance of a "child" class? For example in the code below I would like to be able to reference which exact army a troop belonged to by doing something...
4
2667
by: Steve B | last post by:
I have a system that has been working fine for months, until this week. This is the error message that I am now getting : A DB2 problem occurred. Sqlcode: -712 Sqlstate: 57011 , Sqlerrd.1: -140...
5
2685
by: Cyril Gupta | last post by:
Hello, I have a class inside another class. The Scenario is like Car->Engine, where Car is a class with a set of properties and methods and Engine is another class inside it with its own set of...
7
5654
by: hummh | last post by:
Hello out there, I´m making my first steps with ASP.NET 2.0 and have he following problem: I´ve implemented a Web User Control that sits in the root of my ASP.NET Website. I want to use the...
4
9510
by: Joe | last post by:
This may actually be an IIS configuration issue but any help would be appreciated. I'd like to display some content based upon who the current user is that is accessing an internal ASP.NET...
12
11672
by: Steve Blinkhorn | last post by:
Does anyone know of a way of accessing and modifying variables declared static within a function from outside that function? Please no homilies on why it's bad practice: the context is very...
3
7746
by: Frederick Gotham | last post by:
Back in the day, if you wanted a function to be self-contained within a translation unit, you defined the function as "static". If there were an external linkage function by the same name...
4
8482
by: Joseph Paterson | last post by:
Hi all, I'm having some trouble with the following code (simplified to show the problem) class Counter { protected: int m_counter; }
15
1828
by: TonyV | last post by:
Hey all, for debugging purposes, I'd like to be able to access an object's instance name from within the object class. For example, I'd like to be able to do something like this: ...
0
6908
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
7044
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7084
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6739
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5337
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
4481
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2984
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
181
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.