VB6 to C# Architecture Question - Best Practice?



In VB6, we created a number of ActiveX DLLs that all shared a similar
interface. The main application would load these in dynamically (late-bound.)
This worked well for our situation because we could update the DLLs
independently of the main EXE, and performance was not a problem.

We want to do the same thing in C# (at least test it), but we are not
exactly clear what the best practice is. We would prefer to do something
similar, but we are open to any advice.

In VB6 terms, we have a shared class which serves as the interface to our
DLLs. To keep the example simple, I created this:

‘ VB6 Class Interface
Public Function DoSomething() As Boolean
DoSomething = True
End Function

Each DLL would be compiled with the same class.

A simple example of how we would use this is here:

Private Sub Command1_Click()
Dim objClass As Object
Dim strClass As String
Dim bUseFirstClass As Boolean

bUseFirstClass = False

If bUseFirstClass = True Then
strClass = "prjTestA.clsExample"
Else
strClass = "prjTestB.clsExample"
End If


Set objClass = CreateObject(strClass)

Debug.Print objClass.DoSomething()

Set objClass = Nothing

End Sub


What is the best way to do something similar in C#? We started looking at
reflection, but I want to make sure that is considered the best way to
approach this, or if there is some other words of wisdom we should follow.
Any sample code would be most appreciated!

Thank you for your time and advice.

Mo

.



Relevant Pages

  • Re: Question re Migration of VB6 App to .NET
    ... I've had the opportunity to advise folks on how to move VB6 to .Net in the ... Create an ENTIRELY NEW USER INTERFACE. ... business object layer was actually designed to be independent of the U/I ... Pick a relatively self-contained set of business objects. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Question re Migration of VB6 App to .NET
    ... I've had the opportunity to advise folks on how to move VB6 to .Net in the ... Create an ENTIRELY NEW USER INTERFACE. ... business object layer was actually designed to be independent of the U/I ... Pick a relatively self-contained set of business objects. ...
    (microsoft.public.dotnet.general)
  • Re: Question re Migration of VB6 App to .NET
    ... I've had the opportunity to advise folks on how to move VB6 to .Net in the ... Create an ENTIRELY NEW USER INTERFACE. ... business object layer was actually designed to be independent of the U/I ... Pick a relatively self-contained set of business objects. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: How Big is Too Big?
    ... It holds true, even if you use an interface, because that interface ... would have to be a *common* interface. ... a Common-Interface, wich is sort of universal, to allow e.g. ... It is forcing you to split your app up into different dlls but that it ...
    (microsoft.public.vb.general.discussion)
  • Re: How to marshal code to the original thread
    ... I didn't spend time on the code you posted, I just included here a complete sample (CS and a VB6 code) to illustrate how I think you could implement your wrapper and to prove you can fire events from abitrary CLR threads to VB6 COM clients using connectionpoint interfaces. ... // pay attention to the class decoration, this is important for connectionpoint interface support. ... Private Sub myCowboy_Touched ... | Willy Denoyette wrote: ...
    (microsoft.public.dotnet.languages.csharp)