Is it possible, to use one DLL's internal method ?
I've decompiled the .net dll, using Reflector and dotPeek, and found what I need, name and parameters of the method.
I've already made a simple program to call the public ones, so I'm fine with this.
CFF Explorer (here) allows to change some things to public/private/static/etc...
Did anyone tried this with success? Thanks.
            Asked
            
        
        
            Active
            
        
            Viewed 116 times
        
    1
            
            
         
    
    
        Filipe YaBa Polido
        
- 1,656
- 1
- 17
- 39
- 
                    1You can do it using Reflection. See [this question](http://stackoverflow.com/questions/135443/how-do-i-use-reflection-to-invoke-a-private-method-in-c) for example. – RB. Mar 20 '13 at 11:42
1 Answers
1
            Yes, you could use Reflection. Consider the following class:
public class A
{
    internal void Method(string val) { }
}
to consume that method you would need to do something like this:
var a = new A();
var methodInfo = a.GetType().GetMethod("Method", BindingFlags.Instance | BindingFlags.NonPublic);
if (methodInfo == null) { return; }  // the method wasn't found on the type
methodInfo.Invoke(a, new object[] { "parameter value" });
and if the method returned a value:
var result = methodInfo.Invoke(a, new object[] { "parameter value" });
 
    
    
        Mike Perrenoud
        
- 66,820
- 29
- 157
- 232
- 
                    Ok, I'll try it on. .Net is not my language of choice :) :) Thanks – Filipe YaBa Polido Mar 20 '13 at 18:12
-