CAD233
2018-06-06 09:39
采纳率: 80%
浏览 2.9k

C#如何getvalue函数值

RequestData调用: RequestData.PutValue(String key, String value)

ResponseData调用:ResponseData.GetValue(Key as String) As String

TypReq = Type.GetTypeFromProgID("BB.RequestData");
TypRes = Type.GetTypeFromProgID("BB.ResponseData");
TypMis = Type.GetTypeFromProgID("BB.MisPos");

            request = Activator.CreateInstance(TypReq);
            response = Activator.CreateInstance(TypRes);
            mispos = Activator.CreateInstance(TypMis);


            TypMis.InvokeMember("PutValue", BindingFlags.InvokeMethod, null, request, new Object[] { "CardType", "01" });
            TypMis.InvokeMember("PutValue", BindingFlags.InvokeMethod, null, request, new Object[] { "TransType", TransType });

            TypMis.InvokeMember("TransProcess", BindingFlags.InvokeMethod, null, mispos, new Object[] {request, response});
            Console.WriteLine("response");
                            现在无法打印出response 的值,即函数ResponseData的返回值
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • blownewbee 2018-06-06 09:50
    已采纳

    TypMis .GetMethod("PutValue").Invoke(mispos, new Object[] { "CardType", "01" })

    点赞 评论

相关推荐 更多相似问题