I have a .NET DLL which I call from a VB6 project.
Until now, I've had a public static class with a bunch of
public const String STRING_NAME = "STRING VALUE";
When I needed to use one of them from VB6, I directly wrote inline the literal value in the code.
Now I'd like to replace those literals with the .NET constants.
I have tried changing the "const" for "static readonly", and I have added the GUID and ComVisible attributes, to the class, and now I can see the class in VB6, but it has no members.
I开发者_如何学Cs this possible at all? How?
COM doesn't have a mechanism for sharing constants (except for enumerations, but that won't help with strings).
Best bet might be do define a class which contains a set of get only properties to return the values, and then create an instance in the VB code (and keep around).
精彩评论