ParameterModifier[] 使用
来源:互联网 发布:ip 连不上数据库mysql 编辑:程序博客网 时间:2024/05/01 16:08
ParameterModifier[] argument is only used when doing late bound COM interop calls
for your purpose, you only need to do
Type[] paramTypes = new Type[] {Type.GetType("System.String&")};
MethodInfo mi = typeof(TestRef).GetMethod( "GetMessage", paramTypes );
try
using System;
using System.Reflection;
class TestRef
{
public int GetMessage(ref string Message, out int value2)
{
Console.WriteLine(Message);
Message = "123";
value2 = 100;
return 2;
}
public static void Main()
{
TestRef tr = new TestRef();
String s="";
int out2;
int i = tr.GetMessage(ref s, out out2);
Console.WriteLine("normal way: {0}:{1}:{2}", i, s, out2);
Type[] paramTypes = new Type[] {Type.GetType("System.String&"), Type.GetType("System.Int32&")};
MethodInfo mi = typeof(TestRef).GetMethod( "GetMessage", paramTypes );
if (mi != null)
{
Console.WriteLine(mi.Name);
string s2 = "abc";
object[] o = new object[2];
o[0] = s2;
int i2 = (int)mi.Invoke(tr, o);
Console.WriteLine("reflection:{0}:{1}:{2}", i2, o[0], o[1]);
}
}
}
- ParameterModifier[] 使用
- Type.InvokeMember 方法 (String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])
- 使用
- 使用
- 使用
- 使用
- 使用
- 使用
- 使用++,--
- 使用$@ $!
- 使用
- SoftICE使用(指令使用)
- 使用GraphEdit使用
- 使用HtmlParser使用心得
- 时钟使用使用
- Ubuntu 使用Git 使用
- Ubuntu 使用Git 使用
- GUID使用的使用
- 几种开源的TCP/IP协议栈分析
- 日历控件【分享】
- JavaScript的方法和技巧【70个】
- linux内存信息
- 必须掌握的八个【cmd 命令行】
- ParameterModifier[] 使用
- 一些oracle相关网站
- 收割白菜
- JSP基础速成【精华】
- UbuntuFlash 中文变乱码(方格)
- 新手学习Java之路
- 新手
- Using the Oracle Wait Interface to Troubleshoot I/O Issues
- 儿子六岁