Re: Class vs. DLL

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



As you are trying to do, it is always a good practice to move common
functionality away from the application so that it can be shared.

Now some clarification regarding your "class" vs. "dll" question. A DLL is
a container for classes, therefore when you create a class, it is compiled
into a DLL/Assembly. You can simply create another "library" project and
move your classes/code from the console project. Once done, then yes, you
have to add a reference to that assembly in your console application.

As to whether you use a "using" statement depends on your namespaces. If
your choose to give your library code a different namespace from your
application (which you will probably want to do since this code will be
shared) then you will also need to add a "using"directive in any application
file that references your utility classes.


"Paolo" <Paolo@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:968DD95E-E101-41A9-A7C9-5AFDC74E98DC@xxxxxxxxxxxxxxxx
Learning C# using Console applications. I want to develop some utility
functions (wrapping up some of the Console class methods) so that I can
have
them available for any program that I write.

If I create a DLL do I include these functions by adding it as a reference
in my projects?

If I create a Class do I add the 'using' directive to include them?

Are there any pros/cons with respect to either approach?

Thanks


.



Relevant Pages

  • Re: About references and/or the use of the using keyword...
    ... I'm working on the conversion of a VB.NET app that includes a rerence to ... as namespaces that. ... So it seemed the presence of the reference for the Microsoft.VisualBasic ... What you are seeing here is that many assemblies have the same ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: to dispose or not ?
    ... The is the console output if Ctrl-Break is pressed while the console read is active: ... Note that the event handler is still hooked in and processes the Ctrl-Break -- then it is passed to ... GC.KeepAlive(obj) is clearer than obj = Nothing ... setting the reference to nothing reduces the reference count to ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Creating a Process from a windows service
    ... My dll is not a regular dll it is a visual ... the reference that i am recieving the System.IO.FileNotFoungException? ... your CreateProcess call? ... windows service that would simply launch the console application. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Best way to use static method functions from MC++ lib in VB.NET
    ... > I'm wondering if there is an alternative to creating a reference to the ... Namespaces are used to lessen the possibilty that two ... of multiple simultaneous updates of shared data by code running in distinct ...
    (microsoft.public.dotnet.languages.vc)
  • Re: VS.NET Public Namespaces, classes, Function - Conceptual misunderstanding.
    ... having to locate and reference them. ... would have the canonical list of namespaces and classes when you opened ... Company specific DLLs, well if you're going to build libraries then put ... Provided you're using a decent source control system, ...
    (microsoft.public.dotnet.framework.aspnet)