Reputation: 23
I was using a DLL in C# and called a method which returned me a C# object of the DBConnection class. My question is, if the DLL don’t know which language it will be used on, how can it return an object of a C# class?
Upvotes: 2
Views: 86
Reputation: 617
The .NET assembly is a standard independent of language. If you write a code in c# it will generate the same "assembly" .NET than VB .NET or F#.
The DLL does not return a "C# Object". The DLL return a .NET object.
Upvotes: 1
Reputation: 415725
Not all DLLs are created equal. Some are COM-specific. Some are not. Some are .Net IL assemblies. Some are not. This DLL is a .Net assembly. The class objects it provides for your are not strictly C# objects. They are .Net objects.
This works out for you because C# is itself built for .Net, and uses .Net objects. If you were using VB.Net, F#, IronPython, C++CLR, or other platform that uses .Net, you'd also be able to use the DLL. But C, Java, VBA etc would have a much harder time.
Upvotes: 3