Complete Posted December 1, 2008 Share Posted December 1, 2008 After someone creates a DLL in C# using the Microsoft Visual development environment, how would another programmer take that code, make a new project that includes the DLL's source and make a GUI that uses the DLL'S API? Link to comment Share on other sites More sharing options...
0 Rejinderi Posted December 1, 2008 Share Posted December 1, 2008 After someone creates a DLL in C# using the Microsoft Visual development environment, how would another programmer take that code, make a new project that includes the DLL's source and make a GUI that uses the DLL'S API? normally we just add a reference to the dll so we can start using the codes from it.. u can do that from solution explorer right click the project > add reference Link to comment Share on other sites More sharing options...
0 Complete Posted December 2, 2008 Author Share Posted December 2, 2008 normally we just add a reference to the dll so we can start using the codes from it.. u can do that from solution explorer right click the project > add reference I have done a few things. I have created a console app to use as the front-end to the project. Then I have added the DLL as a reference like this: 1) In the Solution Explorer right-click "References" and select "Add Reference ...". 2) Select the "Browse" tab. 3) Navigate to the DLL and select it. 4) Add the appropriate using directive to the code file(s) where you want to use the DLL. I have also found that I can add the Project that the DLL was made in into my new Solution file. I have included the namespace of the DLL in the "using" section of my code. And the intelligent type I am using recognizes this class when I declare it in my code. But it does not seem to recognize all the methods (api's) of the class. What am I doing wrong? Strangely, "Equals", "GetHashCode", "GetType" and "ToString" are not seen in the DLL's source code for available methods for this class. Also, I know that if you double click on the added reference, an Object Explorer should come up showing the available methods. This is not what happens: So now to look closer at the DLL source code.Could there be a problem in the fact that the constructor ( private NookieBookieDoopieDoo() ) is defined as a privvate? Could there be a problem that the methods are static? It looks something like this: namespace BladaFlabaDab { public class NookieBookieDoopieDoo { private static readonly string SomethingYouDoNotNeedToKnow = @"SLAMADAMNADDORK"; private NookieBookieDoopieDoo() { } public static void Send(string to, string subject, string body) { . . . } public static void Send(string to, string replyTo, string subject, string body) { . . . } private static void InitializeClient() { . . . } } } Could there be a problem in the fact that the constructor ( private NookieBookieDoopieDoo() ) is defined as a privvate? Could there be a problem that the methods are static? Link to comment Share on other sites More sharing options...
0 Rejinderi Posted December 2, 2008 Share Posted December 2, 2008 ya look.. those are static methods.. u dont have to create a instance of the class in order to call them.. just do NookieBookieDoopieDoo.Send Link to comment Share on other sites More sharing options...
0 Antaris Veteran Posted December 2, 2008 Veteran Share Posted December 2, 2008 The static keyword is used to mark a method/property/type as usuable without instantiation. So basically, I can make operations of a type available without having to declare and create a type: public class MyTestClass { public static void MyStaticOperation() { } public void MyInstanceOperation() { } } MyTestClass.MyStaticOperation(); // <- works, calling the operation without declaring an instance of MyTestClass. MyTestClass.MyInstanceOperation(); // <- won't work, because we need to call MyInstanceOperation from an instance of MyTestClass. MyTestClass instance = new MyTestClass(); instance.MyInstanceOperation(); // <- works, calling the operation from the instance. The class you are using as a private constructor, so its likely that it will always be used in a static fashion, so really the entire class should be labelled as static. Strangely, "Equals", "GetHashCode", "GetType" and "ToString" are not seen in the DLL's source code for available methods for this class. All objects within the .NET Framework inherit from System.Object. This is an implicit inheritance because you have not expressed an explicit inheritance, e.g.: public class MyTestClass : MyBaseClass { // This class is explicitly inheriting from MyBaseClass } public class MyTestClass { // This class is implicitly inheriting from System.Object } Those operations you see "Equals", "GetHashCode", "GetType" and "ToString" are implemented by the System.Object type, and become available to any subclass (which would be every object in the .NET Framework). Hope that clears some stuff up for you. Link to comment Share on other sites More sharing options...
0 Rejinderi Posted December 2, 2008 Share Posted December 2, 2008 lol i saw u post this question like on 129034029402 c# forums >.> Link to comment Share on other sites More sharing options...
0 Complete Posted January 13, 2009 Author Share Posted January 13, 2009 lol i saw u post this question like on 129034029402 c# forums >.> I did not know there were that many C# Forums. I guess the internet has gone intergalatic. Link to comment Share on other sites More sharing options...
Question
Complete
After someone creates a DLL in C# using the Microsoft Visual development environment, how would another programmer take that code, make a new project that includes the DLL's source and make a GUI that uses the DLL'S API?
Link to comment
Share on other sites
6 answers to this question
Recommended Posts