MethodInfo.Invoke with out Parameter

前端 未结 1 635
有刺的猬
有刺的猬 2020-11-29 02:58

an example code what I try to do will surely do better than my english:

public bool IsNumericValueInBounds (string value, Type numericType)
{
  double d = do         


        
相关标签:
1条回答
  • 2020-11-29 03:41
    public static bool TryParse( string text, out int number ) { .. }
    
    MethodInfo method = GetTryParseMethodInfo();
    object[] parameters = new object[]{ "12345", null }
    object result = method.Invoke( null, parameters );
    bool blResult = (bool)result;
    if ( blResult ) {
        int parsedNumber = (int)parameters[1];
    }
    
    0 讨论(0)
提交回复
热议问题