What is difference between public and internal modifiers in c# [Resolved]

Posted by Jitendrasoft09 under C# on 6/26/2013 | Points: 10 | Views : 1001 | Status : [Member] [MVP] | Replies : 4
Hi All,
I want to understand What is difference between public and internal modifiers in c#, let me know if anybody knows

Jitendra Kumar
If my post helps you, plz mark as an answer.



Responses

Posted by: Satyapriyanayak on: 6/27/2013 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
Public: When Members of a class are declared as public, then they can be accessed

1. Within the class in which they are declared.
2. Within the derived classes of that class available within the same assembly.
3. Outside the class within the same assembly.
4. Within the derived classes of that class available outside the assembly.
5. Outside the class outside the assembly.


Internal: When Members of a class are declared as internal, then they can be accessed

1. Within the class in which they are declared.
2. Within the derived classes of that class available within the same assembly.
3. Outside the class within the same assembly.


If this post helps you mark it as answer
Thanks

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Niladri.Biswas on: 6/26/2013 [Member] Platinum | Points: 25

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

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



Best Regards,
Niladri Biswas

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Niladri.Biswas on: 6/26/2013 [Member] Platinum | Points: 25

Up
0
Down
http://msdn.microsoft.com/en-us/library/yzh058ae(v=vs.80).aspx

http://msdn.microsoft.com/en-us/library/7c5ka91b(v=vs.80).aspx

Best Regards,
Niladri Biswas

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jitendrasoft09 on: 6/27/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Good effort Niladri...., Nice explanation Satya....

Jitendra Kumar
If my post helps you, plz mark as an answer.

Jitendrasoft09, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response