1,105,334 Community Members

how do i use dll and dot cs file.

Member Avatar
Ravenous Wolf
Junior Poster
164 posts since Aug 2007
Reputation Points: 23 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 0 [?]
 
0
 

hi.

i am kind of stuck and i need some help. i have a dll and a .cs file. i have opened the .cs file and it contains a class. i asume that the class and the dll works together. sort of like a cpp header file and class file. only in this case the class file is instantiated and act as the gateway to the dll where in cpp the header would be the gateway the cpp file.

the problem is i dont exactly know what to do with the two. i have added a reference to the dll by right clicking on references and adding the dll. but what do i do with the .cs. and also i am sure that i am going to need a using statement somewhere before i create the main function. the question here is the path.

so have i done the correct thing with the dll and what do i do with the dot cs. and what do i type as a path name for the dot cs file.

thank you.

Member Avatar
hollystyles
Veteran Poster
1,179 posts since Feb 2005
Reputation Points: 113 [?]
Q&As Helped to Solve: 78 [?]
Skill Endorsements: 0 [?]
 
0
 

i am kind of stuck and i need some help. i have a dll and a .cs file. i have opened the .cs file and it contains a class. i asume that the class and the dll works together. sort of like a cpp header file and class file

No. The dll is one or more compiled .cs files, it is a class library. Microsoft calls them assemblies because they are different to the old style COM dll's where a .tlb (type library) also had to be registered separately. .NET assemblies have a 'manifest' embedded in them instead. The .cs file and the dll are not related in a .h/.cpp kind of way at all.

but what do i do with the .cs.

Just have it in your project folder. The dll should be in your bin folder or installed in the GAC (Global Assembly Cache)

also i am sure that i am going to need a using statement somewhere before i create the main function

If you are going to use the types in the now referenced dll, if you dont want to type:

huge.long.namespace.classA classa = new huge.ong..blah

Where ClassA is a type that is compiled in the dll you have. Then you need a using statement yes:

using huge.long.namespace;

namespace myNamespace
{
    class Program
    {
        static void Main(string[] args)
        {
                //program implementation...
                ClassA classa = new ClassA();
         }
      }
}
Question Answered as of 6 Years Ago by hollystyles
Member Avatar
Ravenous Wolf
Junior Poster
164 posts since Aug 2007
Reputation Points: 23 [?]
Q&As Helped to Solve: 3 [?]
Skill Endorsements: 0 [?]
 
0
 

thanks holly. actually the dot cs and the dll is the exact same thing. i found out when i add a reference to both and the compiler warned me of a conflict!

the dot cs is all the programming code which creates the class and the dll is the same class after being compiled. i have not added the dll to the bin. i just added a reference to the dot cs. but i am sure that i can instead either add a reference to the dll or add it to the bin. either of these three action should be enough for the class to work.

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article