Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>1) why we give reference to the other project? cant we just use inheritance?</p> </blockquote> <p>This question makes no sense. What does inheritance have to do with project references. Can you elaborate?</p> <blockquote> <p>2) after we give the reference by using the visual studio IDE why we have to add the project to the namespace system?</p> </blockquote> <p>Because there's an inherent difference between an assembly referencing another assembly (which is what happens when you add a reference to the project) and the <em>language</em> knowing where to find a <em>class</em> which is what happens when you use the <code>using</code> directive in a file.</p> <p>For example, suppose you create a class in your project called <code>TextBox</code>. Then in another file you want to use that class. How would the language know whether you are referring to your custom <code>TextBox</code> class or another one in a referenced assembly? The answer to that question is <em>namespaces</em>. By fully-qualifying the class name with its namespaces, you tell the compiler which class you're using.</p> <p>The <code>using</code> directive is a way to specifying the namespace once per file instead of every time you use the class (or other classes in that namespace). So if you need to reference your <code>TextBox</code> class multiple times within a single file, you wouldn't want to have to write this <em>every</em> time:</p> <pre><code>MyCodebase.MyAssembly.MyNamespace.MyOtherNamespace.SomethingElse.TextBox </code></pre> <p>Instead, you include a <code>using</code> directive of the entire namespace, so you only have to write this:</p> <pre><code>TextBox </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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