Acessing DLL members which differ only in Case from VB.net

B

Bob S

I am accessing the MoveableGraphicsLibrary which was suggested in a
different post. The base code is written in C# and is contained in a DLL.
In reproducing one of the small sample programs, I ran into the following
difficulty.

From the meta-data in the DLL:

public abstract class GraphicalObject
{
...
protected Cover cover;

public Cover Cover { get; }
...
}

In the derrived class (PrimitiveRectangle)
Public Class PrimitiveRectangle
Inherits MoveGraphLibrary.GraphicalObject

Public Overrides Sub DefineCover()
Dim lclCover As MoveGraphLibrary.Cover

Dim node As CoverNode = New CoverNode(0,
Auxi_Geometry.CornersOfRectangle(rc))
node.Clearance = True
lclCover = New Cover(New CoverNode() {node})

Me.Cover = lclCover
End Sub

I get the error that property Cover is read only.
Since VB is not case sensitive, I have not been able to access
the member "cover" to which I am required to assign a value.

Is there a way to access a case sensitive member from VB when
another member in the class differs only in case?

Thank you for any help.
 
A

Armin Zingler

Am 25.03.2010 21:41, schrieb Bob S:
I am accessing the MoveableGraphicsLibrary which was suggested in a
different post. The base code is written in C# and is contained in a DLL.
In reproducing one of the small sample programs, I ran into the following
difficulty.

From the meta-data in the DLL:

public abstract class GraphicalObject
{
...
protected Cover cover;

public Cover Cover { get; }
...
}
[...]

"Names cannot differ by case alone." Taken from (bottom most bold line):

http://msdn.microsoft.com/en-us/library/ms229043.aspx

Seems somebody didn't follow the rules. So you can't use the Dll the
way you intended.
 
P

Patrice

Hello,

You could perhaps try to do that by using System.Reflection and more
specifically the GetField method (and then FieldInfo.SetValue that allows to
define the value for this field on a particular instance) :
http://www.switchonthecode.com/tutorials/csharp-tutorial-using-reflection-to-get-object-information

If it works (which is IMO likely) you could then inherit from this class and
fix first its bad design. Then inherit again from a "cleaner" class and have
your real code.

If or once the author fixes this you'll get rid of the intermediate "fixing"
level...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top