1

I have some jar files which I converted to .dll using IKVM tool.
My problem is the converted classes contains '$'.

enter image description here

When I try to create an instance of that class, my code becomes invalid because of '$'.

enter image description here

Can this be fixed?

D Stanley
  • 149,601
  • 11
  • 178
  • 240
yonan2236
  • 13,371
  • 33
  • 95
  • 141
  • 1
    dynamic obj = Activator.CreateInstance(Type.GetType("Really$WeirdTypeName")) but you have to live without compile-time checks and live with dynamic. Much better to decompile that code to rename types... – Adriano Repetti Jun 14 '16 at 14:38
  • See if [this answer](http://stackoverflow.com/a/12809657/1081897) helps. – D Stanley Jun 14 '16 at 14:41
  • how I can access the class members and methods using dynamic? – yonan2236 Jun 14 '16 at 14:43
  • If undesired characters are just in type name then you can access members as usual, simply you won't see them with IntelliSense, for example: obj.DoThisAndThat(); However note that more you use them and more trouble you may have (what if there is a _strange_ enum you need to use?) Much better to solve root cause... – Adriano Repetti Jun 15 '16 at 09:10
  • The use of characters which are not permitted in identifiers (like `$`) is a common approach for tool-generated classes which aren't supposed to be instantiated by user code in the first place. While Java *does* allow the dollar sign in identifiers, it's still unlikely that the code itself contains a class with such an unwieldy name, and even less likely that you'd be required to use it, so check if maybe you're doing something wrong first. – Jeroen Mostert Jun 15 '16 at 12:22

0 Answers0