Note that there are some explanatory texts on larger screens.

plurals
  1. POC# class/namespace Access
    primarykey
    data
    text
    <p>I asked this question to multiple people and until now I do not have an answer.</p> <p>ASP.NET C#</p> <p>Project tree (files and folders):</p> <pre><code>&gt; (ROOT) &gt; &gt; Class MyAccess (namespace myproject.core) &gt; &gt; (Directory John) ------&gt; Class MyJohn (namespace myproject.core.John) ------&gt; Class JohnSecret (namespace myproject.core.John) ------&gt; Class OtherJohnSecret (namespace myproject.core.John) &gt; &gt; (Directory Paul) ------&gt; Class MyPaul (namespace myproject.core.Paul) ------&gt; Class PaulSecret (namespace myproject.core.Paul) </code></pre> <p>How can I use (public, private, protected, internal) ????? to have have this behavior:</p> <ul> <li>class MyJohn sees and can create objects from all the classes inside John folder (all his secrets)</li> <li>class MyPaul have the same behavior but inside Paul folder</li> <li>All this secrets CAN NOT be used OUTSIDE this folders.</li> </ul> <p>Examples:</p> <ul> <li>MyPaul can use all his secrets, and he can communicate with the classes MyAccess and with MyJohn.</li> <li>MyPaul, MyJohn, MyAccess will be public or internal </li> <li>MyAccess can not use PaulSecret. </li> </ul> <hr> <p><strong>Solutions that I do not like:</strong></p> <ul> <li><strong>BAD Solution 1</strong></li> </ul> <p>Make John secrets as protected and heritage one MyJohn </p> <p>Example:</p> <pre><code>&gt; protected JohnSecret &gt; internal MyJohn:JohnSecret </code></pre> <p>bad because if i've 100 class secrets I'll need to have something like:</p> <pre><code>&gt; internal MyJohn:JohnSecret1, JohnSecret2,....,JohnSecret100 </code></pre> <ul> <li><strong>BAD Solution 2</strong></li> </ul> <p>Have classes inside classes:</p> <pre><code>&gt; internal class MyJohn { &gt; &gt; internal string DoSomething(){} &gt; &gt; private class JohnSecret{} &gt; private class JohnSecret2{} &gt; private class JohnSecret3{} &gt; &gt; } </code></pre> <p>It's not good because, once again, if I've 100 secrets I'll have a HUGE file, I can't split that code in different source code files.</p> <hr> <p>Can anyone give a good solution?</p> <p>I appreciate :)</p> <p>Thanks a lot.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload