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.

Recommended Answers

All 2 Replies

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();
         }
      }
}

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.