Click here to Skip to main content
15,499,289 members
Home / Discussions / C#
   

C#

 
Questionis a File Read Only. Pin
Saqib Mehmood5-Aug-07 23:32
MemberSaqib Mehmood5-Aug-07 23:32 
AnswerRe: is a File Read Only. Pin
N a v a n e e t h5-Aug-07 23:53
MemberN a v a n e e t h5-Aug-07 23:53 
AnswerRe: is a File Read Only. Pin
Nouman Bhatti6-Aug-07 3:05
MemberNouman Bhatti6-Aug-07 3:05 
Questioninternal and internal protected Pin
Sonia Gupta5-Aug-07 23:25
MemberSonia Gupta5-Aug-07 23:25 
AnswerRe: internal and internal protected Pin
N a v a n e e t h5-Aug-07 23:46
MemberN a v a n e e t h5-Aug-07 23:46 
GeneralRe: internal and internal protected Pin
Sonia Gupta6-Aug-07 0:00
MemberSonia Gupta6-Aug-07 0:00 
GeneralRe: internal and internal protected Pin
N a v a n e e t h6-Aug-07 2:13
MemberN a v a n e e t h6-Aug-07 2:13 
AnswerRe: internal and internal protected Pin
m@u6-Aug-07 0:41
Memberm@u6-Aug-07 0:41 
Hi
Protected is like a private member for a class, but it's visible in derived classes also.
internal is like public but only inside the current assembly.

so.
if you need a property that can be accessed from other classes inside your assembly and a derived class from another assembly should be able to provide a value for it, you make it
protected internal, which means public inside the current assembly and private for all the other asemblies.

let's say you have 2 assemblies the BaseClassLib and the ConsumerLib

now in the BaseClassLib you have 2 classes called ConsumerClass and ProviderClass

<br />
public class ConsumerClass<br />
{<br />
    public ConsumerClass(ProviderClass Provider)<br />
    {<br />
        // calls the Protected internal function of any ProviderClass-derived class<br />
        Console.WriteLine(Provider.getProtIntVal());<br />
    }<br />
}<br />
public abstract class ProviderClass<br />
{<br />
    protected internal abstract string getProtIntVal();<br />
}<br />


in the ConsumerLib you have a Reference to the ProviderLib and you have 2 classes called StartupClass and DerivedProviderClass

<br />
public class DerivedProviderClass:ProviderClass<br />
{<br />
    public DerivedProviderClass()<br />
    {<br />
    }<br />
    protected override string getProtIntVal()<br />
    {<br />
        return "this is a string";<br />
    }<br />
}<br />
public class StartupClass<br />
{<br />
    [STAThread]<br />
    public static void Main(params string[] args)<br />
    {<br />
        DerivedProviderClass c = new DerivedProviderClass();<br />
        // Next will cause a compiler - Error<br />
        console.WriteLine(c.getProtIntVal());<br />
        // Next will work<br />
        ConsumerClass cons = new ConsumerClass(c);<br />
    }<br />
}<br />


hope this helps
greets
m@u
AnswerRe: internal and internal protected Pin
Hessam Jalali6-Aug-07 0:46
MemberHessam Jalali6-Aug-07 0:46 
AnswerRe: internal and internal protected Pin
Pete O'Hanlon6-Aug-07 2:34
mvaPete O'Hanlon6-Aug-07 2:34 
GeneralRe: internal and internal protected Pin
Sonia Gupta6-Aug-07 2:41
MemberSonia Gupta6-Aug-07 2:41 
GeneralRe: internal and internal protected Pin
Pete O'Hanlon6-Aug-07 3:42
mvaPete O'Hanlon6-Aug-07 3:42 
GeneralRe: internal and internal protected Pin
originSH6-Aug-07 5:03
MemberoriginSH6-Aug-07 5:03 
QuestionTake over a GUI of running program Pin
Morad Kobi5-Aug-07 23:21
MemberMorad Kobi5-Aug-07 23:21 
AnswerRe: Take over a GUI of running program Pin
Hessam Jalali7-Aug-07 0:17
MemberHessam Jalali7-Aug-07 0:17 
Questionregarding xml's property dynamically Pin
praveenkumar palla5-Aug-07 22:51
Memberpraveenkumar palla5-Aug-07 22:51 
QuestionDataAdapter.Fill() Pin
blackjack21505-Aug-07 22:43
Memberblackjack21505-Aug-07 22:43 
AnswerRe: DataAdapter.Fill() Pin
Marek Grzenkowicz5-Aug-07 23:04
MemberMarek Grzenkowicz5-Aug-07 23:04 
AnswerRe: DataAdapter.Fill() Pin
N a v a n e e t h5-Aug-07 23:49
MemberN a v a n e e t h5-Aug-07 23:49 
AnswerRe: DataAdapter.Fill() Pin
Nouman Bhatti6-Aug-07 3:12
MemberNouman Bhatti6-Aug-07 3:12 
QuestionFind Out the executed page??? Pin
mimimimilaw5-Aug-07 22:08
Membermimimimilaw5-Aug-07 22:08 
QuestionCalling unmanaged DLL-methodes (winmm.dll) Pin
J. Holzer5-Aug-07 21:32
MemberJ. Holzer5-Aug-07 21:32 
AnswerRe: Calling unmanaged DLL-methodes (winmm.dll) Pin
m@u5-Aug-07 22:29
Memberm@u5-Aug-07 22:29 
AnswerRe: Calling unmanaged DLL-methodes (winmm.dll) Pin
originSH5-Aug-07 22:57
MemberoriginSH5-Aug-07 22:57 
QuestionODBC how to connect reomte SQL Server Pin
jason_mf5-Aug-07 21:16
Memberjason_mf5-Aug-07 21:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.