How to link other *.cs files

Is it possiable for me to include a .cs file in to another file.. what Im tring to do is.. on one file I have created a namespace, and I want to call this namespace on another .cs file, is it possiable Also I'm new to c# only been coding in it for a week.

Thanx :)



Answer this question

How to link other *.cs files

  • ckcampbell

    Thanx guys what I did was..

    csc /target:blah.dll blah.cs

    and that created the dll then I compiled the dll together with the .exe file



  • cynistersix

    So, I assume that you are compiling by running CSC fromm a command line.

    In that case, to compile two source files into one asembly, the syntax would be just (I believe)

    CSC bob.cs jim.cs /other /options /here



  • Hans Erik Lange

    Include another .cs file in your project or referenciate another .cs file from your current .cs file

    You can add the .cs file in your project and use this namespace with 'using namespacename;' in the header of the .cs file where you want use it .

    Regards.



  • Doug_Schulte

    Sorry I'ts my fault for not mentioning that I'm not using any IDE, I'm just using a regular programmers editor, also is it possiable for someone to show me an example or point me in the right direction please. Thank you for your help.

    -- Edit --

    I'm  also using  the .net framework with the cs compilar to compile  my files.


  • Eugene Ye

    it is possible, you just need to add/import that namespace in your using declerations at the top of the class file, then you can access the other namespace and its classes that exist. Does this help

    so if I had 2 namespaces:

    namespace Bob

    namespace jim

    and I wanted Bob to call jim:

    using Jim;

    using System.Data;

    ..

    ..

    I can then access Jim's classes in his namespace



  • How to link other *.cs files