如何将值从函数复制到另一个函数? [英] How do I copy value(s) from a function to another one?
本文介绍了如何将值从函数复制到另一个函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
我想知道如何复制结果值FROMpublic static List< intptr> GChW(IntPtr prnt) INTO theprivate void StartButton_Click(object sender,EventArgs e)。
如果有人给我写了一个示例/实例,我会很高兴。
请帮帮我。 :))
public static List< Intptr> GChW(IntPtr prnt)
{
List< Intptr> result = new List< Intptr>();
GCHandle listHandle = GCHandle.Alloc(结果);
尝试
{
EWP childProc =新EWP(EW);
EChW(prnt,childProc,GCHandle.ToIntPtr(listHandle));
}
最后
{
if(listHandle.IsAllocated)
listHandle.Free();
}
返回结果;
}
private void StartButton_Click(object sender,EventArgs e)
{
}
解决方案
调用它?
private void StartButton_Click( object sender,EventArgs e)
{
List< Intptr> valuesFromTheMthod = GChW(prnt);
....
}你得到传递给它的价值,我不知道 - 但是,我对你的项目一无所知......
Hi Everyone!
I would like to know how to copy the result value FROM """public static List<intptr> GChW(IntPtr prnt)""" INTO the """private void StartButton_Click(object sender, EventArgs e)""".
I will be happy if someone write me an example/instance.
Please help me. :))
public static List<Intptr> GChW(IntPtr prnt) { List<Intptr> result = new List<Intptr>(); GCHandle listHandle = GCHandle.Alloc(result); try { EWP childProc = new EWP(EW); EChW(prnt, childProc, GCHandle.ToIntPtr(listHandle)); } finally { if (listHandle.IsAllocated) listHandle.Free(); } return result; } private void StartButton_Click(object sender, EventArgs e) { }
解决方案
Call it?
private void StartButton_Click(object sender, EventArgs e) { List<Intptr> valuesFromTheMthod = GChW(prnt); .... }Where you get the value to pass to it, I have no idea - but then, I don't know anything about your project...
这篇关于如何将值从函数复制到另一个函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文