[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 211
  • Last Modified:

internal?

Hi

Whats an internal method / field?

Also what is a protected internal?

Thanks
Paul
0
paulwhelan
Asked:
paulwhelan
  • 4
  • 3
1 Solution
 
gdupadhyayCommented:
Hi,
In C#, There r 5 access modifiers, These r
1. public
2. protected
3. private
4. internal and
5. protected internal.
Now,
1. public :   Visible to all.
2. protected : Visible only from derived classes.
3. private : Visible only within the given class.

4. internal : Visible only within the same assembly.
An internal item may only be accessed within the current assembly. An assembly in the .NET Framework equates roughly to Java's JAR file; it represents the building blocks from which other programs can be constructed

For Example :

public class BaseClass
{
       internal static int x = 0;   // Only accessible within the same assembly
}

5. protected internal : Visible only to the current assembly or types derived from the containing class i.e
access is limited to the current assembly or types derived from the containing class.

To know more abt. access modifier please follow this link
http://msdn2.microsoft.com/en-us/library/wxh6fsc7(VS.80).aspx

I hope from my comment u get the answer of ur question.

Thanks
Ganesh Dutt Upadhyay
0
 
paulwhelanAuthor Commented:
Sorry for the newbie question but what exactly is an 'assembly'?

Thanks!
Paul
0
 
paulwhelanAuthor Commented:
And what does "types derived from the containing class" mean?

Thanks
Paul
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
gdupadhyayCommented:
Hi,

Assembly: An assembly is a file that is automatically generated by the compiler upon successful compilation of every .NET application.It can be either a Dynamic Link Library or an executable file. It is generated only once for an application and upon each subsequent compilation the assembly gets updated. The entire process will run in the background of your application.
An Assembly contains Intermediate Language (IL) code, which is similar to Java byte code. In the .NET language, it consists of metadata. Metadata enumerates the features of every "type" inside the assembly or the binary. In addition to metadata, assemblies also have a special file called Manifest. It contains information about the current version of the assembly and other related information.

Now "types derived from the containing class" :
Suppose u have 2 assembly X and Y. u take a reference of X in Y. All the members which is declared in X as "protected internal" only visible in Y (if any class of X take as base class in Y).

I hope u got ur answer.

Thanks,
Ganesh Dutt Upadhyay

0
 
gdupadhyayCommented:
Hi,
Please read this link for more information

http://www.codeguru.com/columns/csharp_learning/article.php/c5845/


Thanks
Ganesh Dutt Upadhyay
0
 
paulwhelanAuthor Commented:
What does "u take a reference of X in Y" mean?
Thanks
0
 
gdupadhyayCommented:
X and Y are two separate assembly and i want to take a reference of one assembly to another.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now