<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: C# Protected Internal</title>
	<atom:link href="http://kossovsky.net/index.php/2009/06/cshar-protected-internal/feed/" rel="self" type="application/rss+xml" />
	<link>http://kossovsky.net/index.php/2009/06/cshar-protected-internal/</link>
	<description>C# Code Snippets, ASP.NET Code Samples, .NET Tips and Tricks</description>
	<lastBuildDate>Tue, 31 Jan 2012 06:04:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: Sanjay Modi</title>
		<link>http://kossovsky.net/index.php/2009/06/cshar-protected-internal/comment-page-1/#comment-33022</link>
		<dc:creator>Sanjay Modi</dc:creator>
		<pubDate>Mon, 23 Jan 2012 16:55:26 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=242#comment-33022</guid>
		<description>Really Good . in simple word you explain every thing</description>
		<content:encoded><![CDATA[<p>Really Good . in simple word you explain every thing</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harish</title>
		<link>http://kossovsky.net/index.php/2009/06/cshar-protected-internal/comment-page-1/#comment-12346</link>
		<dc:creator>Harish</dc:creator>
		<pubDate>Tue, 19 Jul 2011 18:46:08 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=242#comment-12346</guid>
		<description>Great Article</description>
		<content:encoded><![CDATA[<p>Great Article</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bassam Alugili</title>
		<link>http://kossovsky.net/index.php/2009/06/cshar-protected-internal/comment-page-1/#comment-7081</link>
		<dc:creator>Bassam Alugili</dc:creator>
		<pubDate>Thu, 14 Apr 2011 10:50:07 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=242#comment-7081</guid>
		<description>Important point:

For example if u define a method as:

 

 protected internal void DoSomething()
 {
 Console.WriteLine(&quot;I&#039;m Doing...&quot;);
 }

Normally, you think this method is protected and internal!!!! &lt;---- THIS IS WRONG !!!!!

The connection between them is OR  = protected internal means protected OR internal

Example for that if you define an internal property and you try to set the setter or the getter as protected internal you will get a restrictive error  because The union of protected and internal accessibility is less restrictive than protected or internal alone.</description>
		<content:encoded><![CDATA[<p>Important point:</p>
<p>For example if u define a method as:</p>
<p> protected internal void DoSomething()<br />
 {<br />
 Console.WriteLine(&#8220;I&#8217;m Doing&#8230;&#8221;);<br />
 }</p>
<p>Normally, you think this method is protected and internal!!!! <&#8212;- THIS IS WRONG !!!!!</p>
<p>The connection between them is OR  = protected internal means protected OR internal</p>
<p>Example for that if you define an internal property and you try to set the setter or the getter as protected internal you will get a restrictive error  because The union of protected and internal accessibility is less restrictive than protected or internal alone.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: syam</title>
		<link>http://kossovsky.net/index.php/2009/06/cshar-protected-internal/comment-page-1/#comment-6462</link>
		<dc:creator>syam</dc:creator>
		<pubDate>Mon, 28 Feb 2011 13:21:36 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=242#comment-6462</guid>
		<description>I dont know where I am going wrong</description>
		<content:encoded><![CDATA[<p>I dont know where I am going wrong</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: syam</title>
		<link>http://kossovsky.net/index.php/2009/06/cshar-protected-internal/comment-page-1/#comment-6461</link>
		<dc:creator>syam</dc:creator>
		<pubDate>Mon, 28 Feb 2011 13:17:33 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=242#comment-6461</guid>
		<description>if I compile your code I am Not getting any error it is compiling fine..... So I did not understand</description>
		<content:encoded><![CDATA[<p>if I compile your code I am Not getting any error it is compiling fine&#8230;.. So I did not understand</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Artem</title>
		<link>http://kossovsky.net/index.php/2009/06/cshar-protected-internal/comment-page-1/#comment-4661</link>
		<dc:creator>Artem</dc:creator>
		<pubDate>Sun, 03 Oct 2010 10:45:51 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=242#comment-4661</guid>
		<description>&lt;a href=&quot;#comment-4624&quot; rel=&quot;nofollow&quot;&gt;@Xander &lt;/a&gt; 

1. Actually I was wrong because you can&#039;t cast A to A3.

2. I misinterpret your comment. What I meant is that class A3 can access SomeProtectedInternalMethod of class A because SomeProtectedInternalMethod is internal in class A and A3 is in the same assembly. But you made class A3 internal too, and it sounds like you are saying THIS is the reason why it can access the method. But you are not.</description>
		<content:encoded><![CDATA[<p><a href="#comment-4624" rel="nofollow">@Xander </a> </p>
<p>1. Actually I was wrong because you can&#8217;t cast A to A3.</p>
<p>2. I misinterpret your comment. What I meant is that class A3 can access SomeProtectedInternalMethod of class A because SomeProtectedInternalMethod is internal in class A and A3 is in the same assembly. But you made class A3 internal too, and it sounds like you are saying THIS is the reason why it can access the method. But you are not.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xander</title>
		<link>http://kossovsky.net/index.php/2009/06/cshar-protected-internal/comment-page-1/#comment-4624</link>
		<dc:creator>Xander</dc:creator>
		<pubDate>Wed, 29 Sep 2010 15:40:31 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=242#comment-4624</guid>
		<description>&lt;a href=&quot;#comment-4594&quot; rel=&quot;nofollow&quot;&gt;@Artem &lt;/a&gt; 
Hi, Artem

1. You are correct that we don&#039;t have to inherit A3 from A to be able access SomeProtectedInternalMethod from the same assembly (thanks for noticing, probably just mistyped it), but you are wrong about using  ((A3)AI).SomeProtectedInternalMethod() within or outside of an assembly in which class A is declared. You indeed can use it using casting but in the SAME assembly only.

2. You can&#039;t access a method in some class just because the class is in the same assembly.
For example if the method was defined as &quot;protected string SomeProtectedInternalMethod()&quot; or just &quot;string SomeProtectedInternalMethod()&quot; you wouldn&#039;t be able  to access it even in the same assembly because in case of protected you must inherit the class and in the second case it&#039;s just private for the same class.</description>
		<content:encoded><![CDATA[<p><a href="#comment-4594" rel="nofollow">@Artem </a><br />
Hi, Artem</p>
<p>1. You are correct that we don&#8217;t have to inherit A3 from A to be able access SomeProtectedInternalMethod from the same assembly (thanks for noticing, probably just mistyped it), but you are wrong about using  ((A3)AI).SomeProtectedInternalMethod() within or outside of an assembly in which class A is declared. You indeed can use it using casting but in the SAME assembly only.</p>
<p>2. You can&#8217;t access a method in some class just because the class is in the same assembly.<br />
For example if the method was defined as &#8220;protected string SomeProtectedInternalMethod()&#8221; or just &#8220;string SomeProtectedInternalMethod()&#8221; you wouldn&#8217;t be able  to access it even in the same assembly because in case of protected you must inherit the class and in the second case it&#8217;s just private for the same class.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Artem</title>
		<link>http://kossovsky.net/index.php/2009/06/cshar-protected-internal/comment-page-1/#comment-4594</link>
		<dc:creator>Artem</dc:creator>
		<pubDate>Sun, 26 Sep 2010 13:08:19 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=242#comment-4594</guid>
		<description>1. class A3 : A

Class A3 don&#039;t have to inherit from A in your example. If it does, then you can access protected members even on another instance, like this:

A AI = new A();
return ((A3)AI).SomeProtectedInternalMethod();

Within or outside of an assembly in which class A is declared.

2.         // We can access the method through an instance  
            // of the class because it&#039;s internal

Not exactly right. We can access it just because it is in the same assembly.

The point is that you don&#039;t need to declare class A3 as internal (as you did), this has absolutely nothing to do with the access to class A internal members.</description>
		<content:encoded><![CDATA[<p>1. class A3 : A</p>
<p>Class A3 don&#8217;t have to inherit from A in your example. If it does, then you can access protected members even on another instance, like this:</p>
<p>A AI = new A();<br />
return ((A3)AI).SomeProtectedInternalMethod();</p>
<p>Within or outside of an assembly in which class A is declared.</p>
<p>2.         // We can access the method through an instance<br />
            // of the class because it&#8217;s internal</p>
<p>Not exactly right. We can access it just because it is in the same assembly.</p>
<p>The point is that you don&#8217;t need to declare class A3 as internal (as you did), this has absolutely nothing to do with the access to class A internal members.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: internal class</title>
		<link>http://kossovsky.net/index.php/2009/06/cshar-protected-internal/comment-page-1/#comment-3545</link>
		<dc:creator>internal class</dc:creator>
		<pubDate>Thu, 01 Apr 2010 23:22:18 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=242#comment-3545</guid>
		<description>[...] class     C# Protected Internal &#124; .NET Tips &amp; TricksI&#039;ve noticed that most of the c# developers i&#039;am talking to, know exactly what public, private, [...]</description>
		<content:encoded><![CDATA[<div style="color:#008200">
<p>[...] class     C# Protected Internal | .NET Tips &amp; TricksI&#39;ve noticed that most of the c# developers i&#39;am talking to, know exactly what public, private, [...]</p>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shemeer NS</title>
		<link>http://kossovsky.net/index.php/2009/06/cshar-protected-internal/comment-page-1/#comment-3425</link>
		<dc:creator>Shemeer NS</dc:creator>
		<pubDate>Thu, 18 Mar 2010 08:38:29 +0000</pubDate>
		<guid isPermaLink="false">http://kossovsky.net/?p=242#comment-3425</guid>
		<description>nice presentation</description>
		<content:encoded><![CDATA[<p>nice presentation</p>
]]></content:encoded>
	</item>
</channel>
</rss>

