DLL Files


Answer this question

DLL Files

  • jlang64

    Oh,
    I also add that my question is valid for the classes that are compiled at the same time(in the same Assembly).


  • rankind

    Hmm,
    I supposed that at the below codes, that are form the link that you sent, should not have created any error since both class are in the same default namespaces as in the Java.
    So I would like to ask that is not there any default namespaces concept in C#
    So if there is, why does the following ocde snippets create an error


    // Assembly1.cs
    // compile with: /target:library
    internal class BaseClass
    {
    public static int intM = 0;
    }
    // Assembly1_a.cs
    // compile with: /reference:Assembly1.dll
    class TestAccess
    {
    static void Main()
    {
    BaseClass myBase = new BaseClass(); // CS0122
    }
    }


  • Efim

    mert-1 wrote:

    Hmm,
    I supposed that at the below codes, that are form the link that you sent, should not have created any error since both class are in the same default namespaces as in the Java.
    So I would like to ask that is not there any default namespaces concept in C#
    So if there is, why does the following ocde snippets create an error


    The namespace isn't related to the internal access modifier, it is the assembly that is creating the hence around your class.
    Every class in every namespace can use your internal BaseClass as long as they are in the same assembly as the BaseClass.


  • Kerdany

    So, would you answer the following questions
    1 ) Can we say that all different packages have different DLL files
    2 ) When we compile any project, is it true that the classes of the package of that project is compiled
    3 ) By knowing what DLL files means, now we can refer internal keywords. So Can we say that internal keyword has the same meaning with protected keyword in Java

    Thanks


  • Deltoid

    Hi ,
    Firstly thanks very much for your explanatory reply.
    I also want to ask something about assemblies.
    I think all assemblies are constructed by namespaces which include the classes that is compiled at that time, is not it
    So, internal keywords provide us to access the only classes which are located in that namespace(Assembly's namespace), is it true


  • TyTan

    mert-1 wrote:
    Oh,
    I also add that my question is valid for the classes that are compiled at the same time(in the same Assembly).


    Yes, then it should not give any errors.


  • tphsu

    You can create an DLL so that you can easy deploy this with more projects.

    There are no performance penalties, when a DLL is needed it will be loaded and it stays loaded untill the application ends.

    For your development it can be handy to have multiple projects (DLL's) and for the update process it can be usefull to. The user doesn't have to download a very large .EXE file when you only updated one class for example. You can sepperate them by namespace, just as the .NET Framework does.
    • MyApp.Data < MyApp.Data.dll >
      • MyApp.Data.Gateway
      • MyApp.Data.Gateway.Mssql
      • MyApp.Data.Gateway.Access
      • MyApp.Data.Gateway.Webservice
    • MyApp.Net < MyApp.Net.dll >
      • MyApp.Net.Update
    • MyApp.Drawing < MyApp.Drawing.dll >
      • MyApp.Drawing.Imaging
    It can olso be handy for reusing some DLL's in other projects. So maybe when you write an extra AddIn for you application, the AddIn can use the DLL's as well.



  • Kevin.Ji

     mert-1 wrote:
    Hi ,
    Firstly thanks very much for your explanatory reply.
    I also want to ask something about assemblies.
    I think all assemblies are constructed by namespaces which include the classes that is compiled at that time, is not it
    So, internal keywords provide us to access the only classes which are located in that namespace(Assembly's namespace), is it true


    This is correct indeed.

    Quote of deleted reply
     mert-1 wrote:
    I heard that internal keyword means that the visiblity for classes which is kept in the same DLL library(File). So, I wonder that internal keywords provides the visibility for classses which are in the same namespaces.


    No, the internal keyword is an access modifier for types and type members. Internal types or members are accessible only within files in the same assembly. You can read the full details and see and example here: internal (C# Reference).

     mert-1 wrote:
    The reason for my this opinion is that I know that DLL files is constructed by allocating the classes who have similar functions or are a little bit related with each other.
    For example, we use using keywords to call any class of ant specified namespaces. So, does it have the same meaning with this : we call the DLL files of the class that we wnat to use in our project (or files)


    No, a DLL can contain one or more namespaces. Most of the time you have a Namespace like CompanyName.Controls and meybe extra namespaces related to it like CompanyName.Controls.Painting, CompanyName.Controls.Input and CompanyName.Controls.Grid.

     mert-1 wrote:
    And, Does creating namespaces have the same meaning with creating DLL files


    No... the same reason as one quote above



  • vini80

    Another question is that can we say that all default namespaces are specific(not default) according to themselves(their classes and members)


  • AzPc.NET

    So, we do not know that wheter the following snippet are compiled at the same time or not.
    So how can Ms programmer claim that the following code cretae error
    That is what I mean to ask before

    // Assembly1.cs
    // compile with: /target:library
    internal class BaseClass
    {
    public static int intM = 0;
    }
    // Assembly1_a.cs
    // compile with: /reference:Assembly1.dll
    class TestAccess
    {
    static void Main()
    {
    BaseClass myBase = new BaseClass(); // CS0122
    }



  • Siddu

    Thanks very much, this is the answer that I am willing to hear after studying on it too much.

    Best wishes,

    Mert(JavaBoy)


  • Michal Malecki

    You are correct.

  • chrisuk2006

    mert-1 wrote:
    1 ) Can we say that all different packages have different DLL files


    I try to seperate unrealated projects from each other. For example i have an CompanyName.Controls.dll. This library contains all controls that we have created for our applications. In each application is use controls from that library. When someone has found a bug in a control, i can fix it and this will fix it for all projects that are using that library.
    I don't want to re-create the controls for each project, so i bundle them into one library.

    mert-1 wrote:
    2 ) When we compile any project, is it true that the classes of the package of that project is compiled


    I'm not sure what you mean with package But when you compile a project, the full project will be compiled. So all source files that are in this project and all resources will be compiled to an assembly.

    mert-1 wrote:
    3 ) By knowing what DLL files means, now we can refer internal keywords. So Can we say that internal keyword has the same meaning with protected keyword in Java


    I don't have a lot of experience with java, but you can find the exact meaning of the protected keyword here: protected (C# Reference).
    You can also take and look to the following article that will show the difference between the available access modifiers: Accessibility Levels (C# Reference).


  • sian

    Also can we implicitly say that ; assembly == DLL file is true
    If not why
    The reas n for my generilization is that assembly contains the same main(biggest) namespaces with the DLL file, is not it


  • DLL Files