internal

Should I use internal or public visibility by default?

I'm a pretty new C# and .Net developer. I recently created an MMC snapin using C# and was gratified by how easy it was to do, especially after hearing a lot of horror stories by some other developers in my organisation about how hard it is to do in C++. I pretty much went through the whole project at some point and made every instance o...

Accessing internal members via System.Reflection?

I'm trying to Unit Test a class that has many internal functions. These obviously need testing too, but my Tests project is seperate, mainly because it covers many small, related projects. What I have so far is: FieldInfo[] _fields = typeof(ButtonedForm.TitleButton).GetFields( BindingFlags.NonPublic | BindingFlags.Instance ...

ReadOnly vs Property within Assembly Question/Conundrum

How can I make a Property "ReadOnly" outside the Assembly (DLL) for people using the DLL but still be able to populate that property from within the assembly for them to read? For example, if I have a Transaction object that needs to populate a property in a Document object (which is a child class of the Transaction class) when somethin...

internal methods and data structures . .

if i have a protected method, can i pass in a parameter where the data type is declared internal? ...

What is the equivalant of a 'friend' keyword in C Sharp?

What is the equivalant of a 'friend' keyword in C Sharp? How do I use the 'internal' keyword? I have read that 'internal' keyword is a replacement for 'friend' in C#. I am using a dll in my C# project that I have the source code for and yet I do not want to modify the existing code. I have inherited the class and I can use my inherite...

Hiding namespaces containing only internal types in a class library?

I have a class library that has a couple of namespaces containing only internal types. However, when using the class library in an application project, the namespaces shows up in intellisense, but of course they are empty. Is there any way for me to hide the namespaces completely when using intellisense in other projects? I've tried to...

c#, Internal, and Reflection

Duplicate of: Accessing internal members via System.Reflection? Is there a way to execute "internal" code via reflection? Here is an example program: using System; using System.Reflection; namespace ReflectionInternalTest { class Program { static void Main(string[] args) { Assembly asm = Assembly...

Structuring internal mail system

I have two tables in my database: Company table (ID, CompanyName, CompanyUsername, CompanyPassword) Employee table (ID, CompanyID, Name, Username, Password) Right now I am designing an internal mail system for which employees can write to each other, but also write directly to the company account. My internal mail table has these fi...

How Inner Join SQL works internally

My question is not how to use inner join in sql. I know about how it matches between table a and table b. I'd like to ask how is the internal working of inner working. What algorithm it involves? What happens internally when joining multiple tables? ...

C# CF2.0 - System.Activator and Internal classes

I've got a data provider that contains a collection of entities. I only want to be able to create a new entity through the data provider. I.e, to create a new record I need to use: Entity entity = Provider.AddNew(); enity.set_Properties... etc My issue is that if I set my entities to Internal, System.Activator cannot create an Instan...

C# - How to access internal class from external assembly

Hi, Having an assembly which I cannot modify (vendor-supplied) which have a method returning an object type but is really of an internal type. How can I access the fields and/or methods of the object from my assembly? Keep in mind that I cannot modify the vendor-supplied assembly. In essence, here's what I have: From vendor: intern...

How to set a base class internal field

Hi, Im extending a class (DirectoryServices.AccountManagement.Principal) and I need to assign a value to a field in the base class but its marked internal. Can I use reflection to set the value? How would that be done? I found this: base.GetType().GetProperty("unpersisted").SetValue(??, false); But im not quite sure how to give it t...

Firebug internal error message

Hi great folks! I'm using Firefox: 3.5 and Firebug: 1.4.0.b3 On my local Ethernet site I am getting an error message in my firebug console: [Exception... "Component returned failure code: 0x80540006 [nsIStreamListener.onDataAvailable]" nsresult: "0x80540006 (<unknown>)" location: "JS frame :: file:///Users/max/Library/Appl...

Passing a dynamic attribute to an internal constructor

Calling an internal constructor with a dynamic argument in C# 4.0b results in the following exception System.ArgumentNullException: Value cannot be null. Parameter name: constructor Example code (thanks to Jon Skeet) public class Test { internal Test(string x) { } static void Main() { dynamic d = "...

How do you handle internal systems development?

We regularly convince our clients of the values of having a good quality intranet and systems, but within my organisation it doesn't seem that we're "eating our own dogfood". We have really lacklustre intranet systems - a hastily thrown together sharepoint install that no one really oversees. An additional cobbled-together legacy intran...

How do I implement members of internal interfaces

I have been refactoring the codebase of the project that I am currently on so that classes/interfaces which are not useful beyond the confines of the assembly should be declared as internal (rather than public). But I've run into a problem with the following code: internal interface IFirstInterface { ... } internal interface ISecon...

Accessing .exe file within .jar

Hi everyone! I recently created an application and successfully jarred this to c:/my/folder/app.jar. It works like a charm in the following case [Startup #1]: Open cmd cd to c:/my/folder java -jar app.jar But when I do this, it doesn't work [Startup #2]: Open cmd cd to c:/my/ java -jar folder/app.jar Because app.jar contains a ....

How to access internal class using Reflection

Hello there, How can I access an internal class of an assembly? Say I want to access System.ComponentModel.Design.DesignerHost. Here the DesignerHost is an internal and sealed class. How can I write a code to load the assembly and the type. Thanks, Dattebayo... ...

InternalsVisibleTo causes CS0246 error: The Type or Namespace could not be found.

I am trying to enable one assembly to access another assembly's internal classes by adding [assembly:InternalsVisibleTo("assembly-name")] to the second assembly. However, this causes the following error: error CS0246: The type or namespace name 'InternalsVisibleTo' could not be found (are you missing a using directive or an assembly...

Help eliminating friends/internals

I often see people say things like "if you need friend/internal then your design is wrong", could someone tell me how to redesign the following code to eliminate the internal in ChessPiece.Location? It's currently used so that adding a piece to ChessBoard sets the ChessPiece.Location property to match, obviously making it public would b...